Home  >  Article  >  Web Front-end  >  window.open() pops up a centered window_Typical special effects

window.open() pops up a centered window_Typical special effects

WBOY
WBOYOriginal
2016-05-16 19:20:031556browse

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:

Go to a

Disadvantages: It has nothing to do with the size and position of the original window.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn