Results 1 to 5 of 5

Thread: Window positioning on exit

  1. #1
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Window positioning on exit

    Hi,

    I've got this piece of code below:
    Code:
    function leave() {
    window.open('../newindowonexit.html','','toolbar=no,menubar=no,location=no,height=440,width=330');
    }
    what do I add to to open the new window in exactly the position I want it to open? say right in the middle of the page etc. I know its has something to do with x and y coordinates but I dunno how to put it into code.

    thanks for any replies!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    function leave() {
    window.open('../newindowonexit.html','','toolbar=no,menubar=no,location=no,top=100,left=300,height=440,width=330');
    }
    Top and left are the number of pixels from the top and from the left that you wish the upper left corner of the new window to be.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If you wanted it in the middle:
    Code:
    window.open('../newindowonexit.html','','toolbar=no,menubar=no,location=no,top=' + ((screen.height / 2) - 220) + ',left=' + ((screen.width / 2) - 165) + ',height=440,width=330');
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for all the tips guys! I'll surely use both of them.

    One thing, though...now, that I know, the simple stuff...what if I have different links opening different windows/pages that need several types of positioning and customisation?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Then you should check out Popup Window Generator.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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