954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Iframe / firefox issue

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

<html>

<head>
<title>Title here</title>

<script type="text/javascript">
function changeIframeSrc(result)
  {
  	var ilone = document.getElementById("I1");
  	if( ilone && ilone.src)
  	{
  		ilone.src=result;
  	}
  }
  
</script>
</head>
<body>
<h1>Header here:</h1>

<form>
<input type="radio" name="result" onclick="changeIframeSrc(this.value)" value="Subfolder1/index.htm">Radio button option 1
<input type="radio" name="result" onclick="changeIframeSrc(this.value)" value="Subfolder2/index.htm">Radio button option 2
</form>

<iframe name="I1" src="InstallNewport/index.htm" width="95%" height="500">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>

</body>

</html>
kickinmhl
Newbie Poster
2 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

Well.....I'm an idiot!
Sorry, and thanks. glossed right over that.

Thanks again

kickinmhl
Newbie Poster
2 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You