<html>
<head>
<script>
function openWindow(){}
//新窗口打开时弹出确认框
var message = confirm("是否打开新网页");
if(message == true){
//通过输入对话框,确定打开网址。默认为:http://www.imooc.com/
var web = prompt("请输入网址","http://www.imooc.com/");
window.open(web,"_blank","width=400,height=500");
};
</script>
</head>
<body>
<input type = "button" value = "在新窗口打开网站" onclick = "openWindow()">
</body>
</html>
相关分类