運行不了,請查找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(){
? ? // 新窗口打開時彈出確認框,是否打開
? ? var open=confirm("確認新建窗口?");
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? if(open==true)?
? ? {var url=prompt("請輸入網(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
跟你的對比一下就知道問題了,不過我覺得剛開始學習還是用一個有代碼錯誤檢測的編輯器吧
2017-11-28
else前面的大括號放到?</script> 前面
2017-11-27
<html>
?<head>
? <title> new document </title> ? ??
? <script type="text/javascript"> ?
? ? function openWindow(){
? ? if(confirm("確認新建窗口?"))?
? ? {
? ? 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語句里面用的是單引號 而且每個屬性是分開的像這樣寫window.open('http://idcbgp.cn','_blank','width=600,height=400,top=100,left=0');