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
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    806
    Thanks
    42
    Thanked 6 Times in 5 Posts

    centre and drop a popup

    Warnings aside about the desirability of the following, there are two things I would like to be able to do with a popup window:

    1. resize to my preferred dimensions
    2. center the window, and at a predetermined distance from the top.

    How can this be done?

    So far I have:

    *****************

    function SetSize(){
    window.resizeTo(800,600);
    }

    <body onLoad='SetSize();">

    *****************

    ...which only satisfies the first preference. Any ideas on the centering and distance from the top?

    Thanks,

    Terry

  • #2
    TNO
    TNO is offline
    Regular Coder
    Join Date
    Apr 2005
    Posts
    213
    Thanks
    2
    Thanked 1 Time in 1 Post
    Try this:

    top.window.resizeTo(800,600);
    top.window.moveTo((screen.availWidth/2)-400,(screen.availHeight/2)-300);

    400 & 300 being half the size of your window

  • #3
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    806
    Thanks
    42
    Thanked 6 Times in 5 Posts
    Thanks, I might use that - but what if it isn't the size of my normal browser window (1024 x 768)?

  • #4
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    806
    Thanks
    42
    Thanked 6 Times in 5 Posts
    Nope - I'm wrong - it actually works at all pixel resolution displays.

    Thanks a lot.


  •  

    Posting Permissions

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