打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
window.open打开新窗口屏幕居中

方法:

<script>			function openWin(url,name,newWinWidth,newWinHeight){				var winWidth=screen.width;  //获取屏幕宽度				var winHeight=screen.height;  //获取屏幕高度				//获取新窗口距离屏幕左侧的位置				var left=(winWidth-newWinWidth)/2;  				//获取新窗口距离屏幕顶部的位置				var top=(winHeight-newWinHeight)/2;				window.open(url,name,'width='+newWinWidth+',height='+newWinHeight+',left='+left+',top='+top+',toolbar=no,menubar=no,location=no,status=no');				//name:弹出窗口的名字,可不填,用''代替				//toolbar=no 是否显示工具栏。yes为显示				//menubar=no 是否显示菜单栏。yes为显示				//location=no 是否显示地址字段。yes为显示				//status=no 是否添加状态栏。yes为可以			}		</script> 




方法的调用:

<a href="javascript:void(0);" onclick="openWin('new.html','',400,200)">跳转到a</a>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Window.open()激活
转帖:<A HREF="" target="_BLANK">打开的新窗口大小的控制_JJD...
定制浏览器窗口
JS window.open()属性
JavaScript中window.open()打开与window.close()关闭
a的href中使用window.open()方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服