閱讀640 返回首頁    go 阿裏雲 go 技術社區[雲棲]


JS中window.open彈出窗口居中

利用下麵這個js函數可以使window.open彈出的窗口居中
function openwindow(url,name,iWidth,iHeight)
{
var url; //轉向網頁的地址;
var name; //網頁名稱,可為空;
var iWidth; //彈出窗口的寬度;
var iHeight; //彈出窗口的高度;
var iTop = (window.screen.availHeight-30-iHeight)/2; //獲得窗口的垂直位置;
var iLeft = (window.screen.availWidth-10-iWidth)/2; //獲得窗口的水平位置;
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');
}
<a href="javascript:void(0);" >轉到</a>

原帖地址:https://ehaidao.blog.163.com/blog/static/139876521201032844a34485/

最後更新:2017-04-03 12:54:33

  上一篇:go DedeCMS後台經常無法加載編輯器
  下一篇:go 獲取當前月的首日、末日