點(diǎn)按鈕沒(méi)反應(yīng),用別人的代碼能正常運(yùn)行,一行行對(duì)照了也沒(méi)看出來(lái)差在哪里
<!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?message=confirm("你想在新窗口打開(kāi)網(wǎng)頁(yè)嗎?"); ??????//?新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi) ????if(message==true){ ??????var?address=prompt("請(qǐng)輸入網(wǎng)址","http://idcbgp.cn/"); ??????//?通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為?http://idcbgp.cn/ ??????if(address!=null){ ????????window.open(address,'_blank','width=400,height=500,menubar=no,toolbar=no'); ????????} ????????//打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。 ??????else{ ????????document.write("已取消操作"); ????????} ????else{ ??????document.write("好吧,下次再說(shuō)"); ??????} ????} ??</script>? ?</head>? ?<body>? ????<input?type="button"?value="新窗口打開(kāi)網(wǎng)站"?onclick="openWindow()"?/>? ?</body> </html>
第一步就出問(wèn)題,點(diǎn)按鈕沒(méi)有彈出窗口
2017-04-01
剛發(fā)出來(lái)就找到原因了,外層的if少寫了后面的大括號(hào)