View Full Version : Help with Javascript and combining iframes and Netscape layers features?

06-08-2004, 06:52 PM
Hello all,

I have a script that displays a certain .txt file in an iframe depending on the day of the year, which I have included below. The problem is that I need the page to work in both IE and Netscape 4.79 and higher. Because Netscape 4.79 does not support iframes, I need to figure out a way to display the .txt files properly if the site visitor uses Netscape. I have tried nesting <div> or <layer> tags with the <iframe> tags, but nothing seems to work. I am a relative Javascript newbie. :(

If anyone has any suggestions, I would be greatly indebted!

Here is the script:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script language="JavaScript" type="text/javascript">
var now=new Date();
function getTxt(){
document.getElementById('todayInH').src=nowM+nowD+'fra.txt';//for French
<body onload="getTxt()">
<iframe scr="" id="todayInH"></iframe>

06-09-2004, 09:48 AM
only NN4.x supports ilayers or layers, whereas NN6+ and Moz support iframes too, tho iframes are deprecated under XHTML strict.

this bit of code might help:

document.layers ? document.writeln('<ilayer id="todayInH" src=""></ilayer>') : document.writeln('<iframe scr="" id="todayInH"></iframe>') ;

// -->

06-09-2004, 07:04 PM

You will also have a problem using document.getElementById in netscape 4.79 as
it does not support DOM functions.

Why are you stuck with supporting Netscape 4?


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum