欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JavaScript弹出新窗口居中显示

程序员文章站 2022-04-05 08:05:49
...

JavaScript弹出新窗口居中显示 代码如下:

 

<script language="javascript">
      function openWin(u, w, h) {
            var l = (screen.width - w) / 2;
            var t = (screen.height - h) / 2;
            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;
            s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no';
            open(u, 'oWin', s);
      }
</script>
<a href="javascript:void(openWin('http://www.boxiangsk.com/', 600, 500));">Test</a>

转载于:https://www.cnblogs.com/dupeng0811/archive/2011/09/01/2163607.html