Web Analytics Made Easy -
StatCounter center the window horizontally - CodingForum

Announcement

Collapse
No announcement yet.

center the window horizontally

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • center the window horizontally

    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; Jun 17, 2002, 09:25 PM.

  • #2
    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>

    Comment


    • #3
      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."

      Comment

      Working...
      X