Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Javascript and combining iframes and Netscape layers features?

    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">
    <html>
    <head>
    <title>Untitled</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    var now=new Date();
    function getTxt(){
    nowM=now.getMonth()+1;
    nowD=now.getDate();
    nowM=(nowM<10)?'0'+nowM:nowM;
    nowD=(nowD<10)?'0'+nowD:nowD;
    document.getElementById('todayInH').src=nowM+nowD+'fra.txt';//for French
    }
    //-->
    </script>
    </head>
    <body onload="getTxt()">
    <iframe scr="" id="todayInH"></iframe>
    </body>
    </html>
    Last edited by OO7girl; 06-08-2004 at 06:59 PM.

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow use ilayer tags for old Netscape

    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:

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

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    007Girl,

    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?

    Cheers,
    Simon


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •