<!DOCTYPE?html>
<html>
?<head>
??<title>?new?document?</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/>???
??<script?type="text/javascript">??
????function?openWindow()
????{var?mychar=confirm("是否打開網址");
????//?新窗口打開時彈出確認框,是否打開
??????if(mychar==true)
??????{var?mystr=prompt("打開網址","http://www.xianlaiwan.cn");
??????if(mystr!=null)
????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????????{window.open(mystr,"_blank",'height=500px,width=400px,munbar=no,toolbar=no');}
????//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????????else
????????{alert("無法打開");}
??????}
??????else
???????{alert("無法打開");}
????}???
????
??</script>?
?</head>?
?<body>?
??<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>
2017-01-24
confirm()函數后面的中文分號;改成英文分號。應該是這個原因了