window.open居中

方法:

1 function openWin(u, w, h) {

2     var l = (screen.width - w) / 2;

3     var t = (screen.height - h) / 2;

4     var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;

5     s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no';

6     open(u, 'oWin', s);

7 } 

 

示例:

<a href="javascript:void(openWin('http://www.baidu.com/', 600, 500));">Test</a>

 

 

来源:http://blog.csdn.net/liguohuaty/article/details/3467069

你可能感兴趣的:(window.open)