<!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?Nweb=confrim("是否打開(kāi)新窗口?");//?新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
????????if(Nweb==true){
?????????var?Newweb=prompt("確認(rèn)打開(kāi)網(wǎng)址么","http://yifanck.cn/");?//?通過(guò)輸入對(duì)話(huà)框,確定打開(kāi)的網(wǎng)址,默認(rèn)為?http://yifanck.cn/
?????????
?????????if(Newweb!=null){
?????????window.open(Newweb,'_blank','width=400,height=500,menubar=no,toolbar=no');?//打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
?????????}
?????????else{
?????????????alert("再見(jiàn)!");
?????????}
????????}
?????????else{
?????????????alert("再見(jiàn)");
?????????}
????}
??</script>?
?</head>?
?<body>?
????<input?type="button"?value="新窗口打開(kāi)網(wǎng)站"?onclick="openWindow()"?/>?
?</body>
</html>
2016-09-27
confrim寫(xiě)錯(cuò)了是confirm,?if(Nweb==true)這句直接寫(xiě)成if(Nweb)就好,感覺(jué)的變量命名不太好,得遵循駝峰原則,第一個(gè)單詞的首字母先小寫(xiě)為好
2016-09-27
if 的嵌套有問(wèn)題