Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-08-2012, 02:42 PM   PM User | #1
jason_kelly
Regular Coder

 
Join Date: Sep 2011
Posts: 140
Thanks: 88
Thanked 0 Times in 0 Posts
jason_kelly is an unknown quantity at this point
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
jason_kelly is offline   Reply With Quote
Old 06-08-2012, 03:40 PM   PM User | #2
jason_kelly
Regular Coder

 
Join Date: Sep 2011
Posts: 140
Thanks: 88
Thanked 0 Times in 0 Posts
jason_kelly is an unknown quantity at this point
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)
jason_kelly is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:43 AM.


Advertisement
Log in to turn off these ads.