<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>new document</title>
<script type="text/javascript">
function openWindow() {
if(comfirm("是否打开网页?")){
var url = prompt("请输入网址:","https://www.baidu.com/");
window.open("https://www.baidu.com/",'_black','width=400,height=500','toolbar=no,menubar=no,scrollbars=yes');
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
confirm打错了
还有
window.open("https://www.baidu.com/",'_black','width=400,height=500','toolbar=no,menubar=no,scrollbars=yes');
改为 window.open(url,'_black','width=400,height=500','toolbar=no,menubar=no,scrollbars=yes');