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
    Regular Coder
    Join Date
    Jul 2002
    Location
    51 03' -78" N -114 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Making it work in netscape!

    Ok I have a script that I want to use to make a div tag show in the dead center of the page works great in IE! but of course like everything else it doesnt work in netscape here is the script!

    <SCRIPT>
    function fnInit() {

    if(ie){DivID.style.setExpression("left", "document.body.clientWidth/2 - Welcome.offsetWidth/2");} if(ns){Welcome.setExpression("left", "innerWidth/2 - DivID.offsetWidth/2");}
    if(ie){DivID.style.setExpression("top", "document.body.clientHeight/2 - Welcome.offsetHeight/2");} if(ns){Welcome.setExpression("top", "innerHeight/2 - DivID.offsetWidth/2");}

    }
    onlOad=fnInit
    </SCRIPT>

    <div id="DivID" style="position:absolute;visibility:hidden">

    document body content

    </div>
    so what do I replace the offsetWidth and the offsetHeight with for netscape? also what would work for the setExpression as the error I get in netscape is DivID is not defined.
    Last edited by Crash1hd; 01-18-2003 at 07:16 AM.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    51 03' -78" N -114 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SO how Would I go About Defining the DivID?

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Whenever you reference a div, you should do it like this:

    document.getElementById("DivID")

    This method is supported in just about every version 5 browser.


  •  

    Posting Permissions

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