showmylifeqwe11
2019-01-04 15:09
function Wopen(){
var newHeight = 400;
var newWidth = 600;
var height = (window.screen.height-newHeight)/2;
var width = (window.screen.width-newWidth)/2;
window.open('http://www.imooc.com','_blank','width='+newWidth+',height='+newHeight+',top='+height+',left='+width+',menubar=no,toolbar=no, status=no,scrollbars=yes');
}
<script>
var answer = confirm("是否要打开新窗口?");
var newHeight = window.screen.height/2;
var newWidth = window.scree.width/2;
if(answer){
window.open("http://www.imooc.com","_blank","width=newWidth,height=newHeight");
}
</script>
JavaScript入门篇
739817 学习 · 9566 问题
相似问题