Javascript : Open a pop-up center window
72Javascript : Open a pop-up center window
I was having trouble focusing on the screen a new window that was open through a javascript function, until today to demand in some forums discovered a way of doing it.
This way is valid for any resolution because the calculation of the position of the window is based on the size of each screen:
function openWindow()
{var winW = 600;
var winH = 400;
var winX = (screen.availWidth - winW) / 2;
var winY = (screen.availHeight - winH) / 2;
var features = 'left=' + winX + ',top=' + winY +
',height=' + winH + ',' + 'width=' +
winW + ',status=yes,' + 'toolbar=no,
menubar=no,location=no';
window.open('Teste.aspx', null, features);return false;
}
I hope this may be useful to someone.
This post is on my personal blog too, in portuguese languange, here.
|
|
Javascript by David Flanagan (2001, Paperback, Illus...
Current Bid: $29.75
|
|
|
Learn Web Design HTML JAVASCRIPT CSS Video Training DVD
Current Bid: $34.57
|
|
|
Javascript For Dummies
Current Bid: $15.79
|
|
|
Javascript Magic: Java, CCS, HTML and more..eBook, CD
Current Bid: $.99
|
|
|
JavaScript & DHTML Cookbook, Danny Goodman, Very Good B
Current Bid: $4.86
|
|
|
Learn Web Design HTML JAVASCRIPT CSS Video Training DVD
Current Bid: $34.57
|
PrintShare it! — Rate it: up down flag this hub








