Javascript : Open a pop-up center window
71Javascript : 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.
|
|
31 Books, Access, JavaScript, Linux, ASP, Excel, HTML
Current Bid: $31.00
|
|
|
Web Design JAVASCRIPT HTML CSS Training Tutorial DVD
Current Bid: $49.57
|
|
|
Webmaster Tools Second Edition, a Javascript generator!
Current Bid: $5.00
|
|
|
NEW Head First Javascript Code Magnet Kit - O'reilly...
Current Bid: $9.99
|
|
|
Learn Web Design HTML JAVASCRIPT CSS Video Training DVD
Current Bid: $34.57
|
|
|
Website Design (HTML, Javascript, PHP, Flash, Template)
Current Bid: $64.99
|
PrintShare it! — Rate it: up down [flag this hub]








