...

View Full Version : Javascript, Dynamic iFrame and Firefox



TheRealJLo
08-27-2007, 08:59 PM
Well, I finally had a question where I didn't find an answer already on the boards so I had to register. :)

I've got a page that creates an iframe and uses javascript to write to it.

Works like a charm in IE but not Firefox.

Demo: http://www.cafewish.com/jstest.html


<script language="JavaScript"><!--
document.write ('<iframe width="100" height="100" name="myframe" src="blank.htm" FRAMEBORDER="1" scrolling="no"></iframe>');
document.frames[0].document.open();
document.frames[0].document.writeln('<html><head></head><body>');
document.frames[0].document.writeln('YO!</body></html>');
document.frames[0].document.close();
//--></script>

What I get in IE is the "YO!" written to the iframe. What I get in Firefox is the 404 not found page of the site where the original "jstest.html" page and script are hosted.

Any help would be greatly appreciated.

Arty Effem
08-28-2007, 01:25 AM
What I get in IE is the "YO!" written to the iframe. What I get in Firefox is the 404 not found page of the site where the original "jstest.html" page and script are hosted.

The answer awaits you in the JavaScript console.
For the edification of future readers, frames is a property of window.

TheRealJLo
08-28-2007, 04:18 AM
I didn't get the JavaScript Console figured out, but I took the hint and it works great. Thank you very much. Now to go figure out how to work this console. Looks like a great tool!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum