運(yùn)行不了,請(qǐng)查找bug
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function openWindow(){
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? var open=confirm("確認(rèn)新建窗口?");
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? if(open==true)?
? ? {var url=prompt("請(qǐng)輸入網(wǎng)址","http://idcbgp.cn/");
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? window.open(url,"_top","width=400,height=500,menuber=no,toolber=no");}
? ? }else{
? ? ? ? alert("退出");
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-11-28
跟你的對(duì)比一下就知道問題了,不過我覺得剛開始學(xué)習(xí)還是用一個(gè)有代碼錯(cuò)誤檢測(cè)的編輯器吧
2017-11-28
else前面的大括號(hào)放到?</script> 前面
2017-11-27
<html>
?<head>
? <title> new document </title> ? ??
? <script type="text/javascript"> ?
? ? function openWindow(){
? ? if(confirm("確認(rèn)新建窗口?"))?
? ? {
? ? window.open(url,"_top","width=400,height=500,menuber=no,toolber=no");
? ? }else{
? ? ? ? alert("退出");
? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-11-27
window.open語句里面用的是單引號(hào) 而且每個(gè)屬性是分開的像這樣寫window.open('http://idcbgp.cn','_blank','width=600,height=400,top=100,left=0');