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 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2004
    Location
    Perthshire
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code not working in Mozilla

    Help required to make the following piece of code work in Mozilla. It works ok in I.E. but not in Mozilla. I’ve uploaded the page so you can see it in action.

    Go to http://www.salmonfly.co.uk/test1.html to view the page.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>test1</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script>
    function show() {
    eval("document.all.hiddenframe.style.display='block'");
    }
    function hide() {
    eval("document.all.hiddenframe.style.display='none'");
    }
    </script>

    </head>
    <body>
    <p>&nbsp;</p>
    <p><img src="215x1.jpg" style="cursor: pointer; cursor:hand;" alt="Click to show iframe" onclick="show()"></p>
    <div id="hiddenframe"; "layer1" style="display:none; z-index: 1;">
    <iframe src="page2.html" style="position: absolute; left: 305px; top: 50px;
    width: 400px; height: 300px;"></iframe>
    <p><a onclick="hide()" style="cursor: pointer; cursor:hand;">click here to remove iframe</a></p>
    </div>

    </body>
    </html>

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You should be using document.getElementById();

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    this works in IE and FF
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>test1</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <script>
    function show() {
    document.getElementById('hiddenframe').style.display='block';
    }
    function hide() {
    document.getElementById('hiddenframe').style.display='none';
    }
    </script>
    
    </head>
    <body>
    <p>&nbsp;</p>
    <p><img src="215x1.jpg" style="cursor: pointer; cursor:hand;" alt="Click to show iframe" onclick="show()"></p>
    <div id="hiddenframe" name="layer1" style="display:none; z-index: 1;">
    <iframe src="page2.html" style="position: absolute; left: 305px; top: 50px; width: 400px; height: 300px;"></iframe>
    <p><a onclick="hide()" style="cursor: pointer; cursor:hand;">click here to remove iframe</a></p>
    </div>
    
    </body>
    </html>

  • #4
    New Coder
    Join Date
    Mar 2004
    Location
    Perthshire
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Many thanks to you guys for giving me a solution so quickly. That page now works fine in the the two browsers.


  •  

    Posting Permissions

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