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

    Window not centering itself in Firefox

    Any idea why this isn't centering in FF? Is there a syntax issue with the single or double quotes?

    PHP Code:
    var newwindow;
        function 
    helpWindow(url)
            {
                
    newwindow=window.open(url,'name','width=700,height=500,resizable=yes,top='+((screen.availHeight/2)-(500/2))+',left='+((screen.availWidth/2)-(700/2))+'');void(0);
                if (
    window.focus) {newwindow.focus()}
        } 

  • #2
    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
    instead of doing division twice it is easier this way:
    window.open('url','windowName','width=700,height=500,top='+((screen.availHeight-500)/2)+',left='+((screen.availWidth-700)/2)+',OTHER OPTIONS HERE');

    also, why do you have void(0); after the window.open. its not needed at all.

    you may be interested to look at some code i wrote a few years ago that does exactly that. the url is in my sig.
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Thanks, that worked.


  •  

    Posting Permissions

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