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
    Jun 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    center the window horizontally and vertically

    Hi,

    Is there anything you can add to this code to make the window centered horizontally and vertically. Here is the code:

    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->
    </script>


    <a href="#" onClick="MM_openBrWindow(page.html,'','scrollbars=no,width=551,height=324,directories=no,menubar=no, resizable=yes,left=121,top=100')">Click Here</a>
    Last edited by cunning-fox; 06-18-2002 at 03:25 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Didn't test it, because pop ups don't work on my pc, but I think it should work and here it is.

    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    pop = window.open(theURL,winName,features);
    if (document.layers) {
    xoff = (screen.availWidth-pop.window.outerwidth)/2;
    yoff = (screen.availHeight-pop.window.outerheight)/2;
    }else if (document.all) {
    xoff = (screen.width-pop.document.body.scrollWidth)/2;
    yoff = (screen.height-pop.document.body.scrollHeight)/2;
    }
    pop.moveTo(xoff,yoff);
    }
    //-->
    </script>

  • #3
    eak
    eak is offline
    Regular Coder eak's Avatar
    Join Date
    Jun 2002
    Location
    Nashville, TN
    Posts
    354
    Thanks
    0
    Thanked 26 Times in 26 Posts

    Thumbs up

    go to my NewWindow script generator to get the javascript that will do exactly what you want.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."


  •  

    Posting Permissions

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