[转]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

posted @ 2012-06-28 17:14  Seasons1987  阅读(205)  评论(0编辑  收藏  举报