How to centralise a javascript popup
#1
I have the following code for a javascript popup
<script>
function openpopup(){
var popurl="password.htm"
winpops=window.open(popurl,"","width=256,height=12 1,left=100,top=50")
}
</script>
How do I set the left and top settings so it will centralise the popup on in any resolution??
Cheers.
<script>
function openpopup(){
var popurl="password.htm"
winpops=window.open(popurl,"","width=256,height=12 1,left=100,top=50")
}
</script>
How do I set the left and top settings so it will centralise the popup on in any resolution??
Cheers.
#2
This seems to work in IE6 - change the var values to change your window size.
function openpopup()
{
var popurl="password.htm";
var screen_height = screen.height;
var screen_width = screen.width;
var window_height = 121;
var window_width = 256;
var offset_x = ((screen_width - window_width) / 2);
var offset_y = ((screen_height - window_height) / 2);
winpops = window.open(popurl,"","width=" + window_width + ",height=" + window_height + ",left=" + offset_x + ",top=" + offset_y);
}
Rich
function openpopup()
{
var popurl="password.htm";
var screen_height = screen.height;
var screen_width = screen.width;
var window_height = 121;
var window_width = 256;
var offset_x = ((screen_width - window_width) / 2);
var offset_y = ((screen_height - window_height) / 2);
winpops = window.open(popurl,"","width=" + window_width + ",height=" + window_height + ",left=" + offset_x + ",top=" + offset_y);
}
Rich
Thread
Thread Starter
Forum
Replies
Last Post
WRX.
Computer & Technology Related
9
02 September 2002 07:19 PM