Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript problem in Firefox

Status
Not open for further replies.

FRrogoy

Programmer
Jul 3, 2002
34
0
0
US
This works ok in IE, but in Firefox the buttons don't work and I see an error in the javascript console. On the Mozilla forum, I was told I have obsolete javascript. I have select buttons next to a search results table. I replace the iframe on the right when a button is pressed.

HTML (PHP)from mysql_fetch_array while loop for button:
echo("<td><button onClick='return(loadLinkInIframe($id))'>Show</button></td>");

HTML for iframe:
echo ("<iframe name='ifrm' src='recipeframe.php?ID=$id' frameborder='0' width='100%' height='100%' scrolling='auto'>");
echo("</iframe>");

Javascript function:
<SCRIPT language="JavaScript">
function loadLinkInIframe(Id) {
document.getElementById('ifrm').src = "recipeframe.php?ID="+Id;
return (false);}
</SCRIPT>

Error in JavaScript Console in Firefox:
document.GetElementById("ifrm") has no properties.
Thanks in advance for any ideas!

Frank
 
You're not giving the <iframe> an ID of "ifrm" so how is getElementById("ifrm") ever going to find it ...
 
forgoy,

I see where you have named the Iframe.
But don't see where you have given it an ID.


HTH
 
That got it! Thanks!
I guess IE assumed the ID was the same as the name. I've spent many hours revamping my CSS and HTML to get it to work in Firefox. So far, all were problems I created and IE masked! And often where I fudged to compensate for what IE did to try and fix my mistakes, compounding the problems. Thanks again.

Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top