Home > Article > Web Front-end > window.open() pops up a centered window_Typical special effects
Javascript code
function openwindow(url,name,iWidth,iHeight)
{
var url; /Webpage name, can be empty;
var iWidth; //The width of the pop-up window; Get the vertical position of the window;
var iLeft = (window.screen.availWidth-10-iWidth)/2; //Get the horizontal position of the window;
window.open(url,name,'height=' iHeight ',,innerHeight=' iHeight ',width=' iWidth ',innerWidth=' iWidth ',top=' iTop ',left=' iLeft ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no ');
}
Just call this function when using it. Such as:
Disadvantages: It has nothing to do with the size and position of the original window.