confirm() 弹出个确认框 (确定,取消)
prompt() 弹出个输入框 让你输入东西
<!DOCTYPE html>
<html lang="EN"><head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<script type="text/javascript">
// 新窗口打开时弹出确认框,是否打开
function openWindow(){
var str = confirm("是否打开");
if(str == true){
// 通过输入对话框,确定打开的网址,默认为 http://www.baidu.com/
var wangzhi = prompt("打开网址","http:baidu.com/");
if (wangzhi!=null){
window.open('http://www.baidu.com/', '_blank','width=400,height=500');
}else
{document.write("没关系");}
}else
document.write("不打开");
}
//打开的窗口要求,宽400像素,高500像素。
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>