給個(gè)居中打開(kāi)新窗口的例子
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://idcbgp.cn','_blank','width='+newWidth+',height='+newHeight+',top='+height+',left='+width+',menubar=no,toolbar=no, status=no,scrollbars=yes');
? }?
2019-01-04
<script>
var answer ?= confirm("是否要打開(kāi)新窗口?");
var newHeight = window.screen.height/2;
var newWidth = window.scree.width/2;
if(answer){
?window.open("http://idcbgp.cn","_blank","width=newWidth,height=newHeight");
}
</script>