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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    182
    Thanks
    139
    Thanked 0 Times in 0 Posts

    Center Popup Window

    Hello,

    I need your help.

    I am trying to create a centered popup window on the clients screen along with a document.write as opposed to a url.

    How would I able to center this automatically on the clients screen:

    Code:
    window.open('','','width=100,height=250,status=no,resizable=no,top=200,left=300').document.write(str_html)
    Much thanks and appreciation for all your help in advance.

    Cheers,

    Jay

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    182
    Thanks
    139
    Thanked 0 Times in 0 Posts
    With a little bit more of internet surfing, I was able to resize and center the popup window. However, the contents inside of it now look all mangled and pushed to the left (looks like there are forced margins). Is there a way to preserve or auto fit the contents to the popup window?

    Code:
        var width = 500;
        var height = 300;
        var left = parseInt((screen.availWidth/2) - (width/2));
        var top = parseInt((screen.availHeight/2) - (height/2));
        var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
        myWindow = window.open('', '', windowFeatures).document.write(html)


  •  

    Posting Permissions

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