首页 > 技术文章 > window.open窗口显示在屏幕中央

feng12345 2016-03-26 22:49 原文

function showNew()
{
var width=200;
    var height=200;
var y=(window.screen.availHeight-200);
var x=(window.screen.availWidth-200);
var mywindow=window.open("","_blank","height="+height+",width="+width);
mywindow.moveTo(x/2,y/2);
}
</script>
<input type="button" value="点击" onclick="showNew()">

推荐阅读