Iframe / firefox issue

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Apr 2008
Posts: 2
Reputation: kickinmhl is an unknown quantity at this point 
Solved Threads: 0
kickinmhl kickinmhl is offline Offline
Newbie Poster

Iframe / firefox issue

 
0
  #1
Apr 16th, 2008
I am having this compatibility probelm with IE vs. Firefox. The below code works perfectly fine in IE but not in Firefox.

Essentially it is a pair of radio buttons and an Iframe below it. I want the Iframe content to change when the radio button option is selected. the initial page displays fine on load, but the radio buttons do not change the content in firefox, it does in IE

Any idea what I am doing wrong here?
Thanks for your help


JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2.  
  3. <head>
  4. <title>Title here</title>
  5.  
  6. <script type="text/javascript">
  7. function changeIframeSrc(result)
  8. {
  9. var ilone = document.getElementById("I1");
  10. if( ilone && ilone.src)
  11. {
  12. ilone.src=result;
  13. }
  14. }
  15.  
  16. </script>
  17. </head>
  18. <body>
  19. <h1>Header here:</h1>
  20.  
  21. <form>
  22. <input type="radio" name="result" onclick="changeIframeSrc(this.value)" value="Subfolder1/index.htm">Radio button option 1<br />
  23. <input type="radio" name="result" onclick="changeIframeSrc(this.value)" value="Subfolder2/index.htm">Radio button option 2<br />
  24. </form>
  25.  
  26. <iframe name="I1" src="InstallNewport/index.htm" width="95%" height="500">
  27. Your browser does not support inline frames or is currently configured not to display inline frames.
  28. </iframe>
  29.  
  30. </body>
  31.  
  32. </html>
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,609
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Iframe / firefox issue

 
0
  #2
Apr 16th, 2008
You are doing a getElementById() for "I1" but there is no element which goes by the ID "I1"; you only have an IFRAME with a name attribute of "I1". IE is infamous for allowing such things to slip by. If a call to getElementById() returns null , it looks for an element with the same name and if found; uses that. I am pretty sure your code would have failed even in Opera or any decent browser out there.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 2
Reputation: kickinmhl is an unknown quantity at this point 
Solved Threads: 0
kickinmhl kickinmhl is offline Offline
Newbie Poster

Re: Iframe / firefox issue

 
0
  #3
Apr 16th, 2008
Well.....I'm an idiot!
Sorry, and thanks. glossed right over that.

Thanks again
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,609
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Iframe / firefox issue

 
0
  #4
Apr 16th, 2008
You are welcome. :-)

BTW, if your question is answered, please mark the thread as solved by clicking on the link 'Mark As Solved' so that it becomes easy for others who use the search feature of this forum to find solution to their problems.
Last edited by ~s.o.s~; Apr 16th, 2008 at 5:02 pm.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC