編程訓(xùn)練為啥不好使,大神幫我看看
<!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 newtage=confirm("是否打開(kāi)網(wǎng)該網(wǎng)址?");
? ? if(newtage==true)
? ? ?{var needtage=prompt("輸入網(wǎng)址","http://idcbgp.cn/");}
? ? if(needtage!=null)
? ? ?{window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
? ? else
? ? ? {alert(thanks)}
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-07-06
<!DOCTYPE HTML>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ? function openWindow()
? ? {
? ? ? if(confirm("是否打開(kāi)網(wǎng)該網(wǎng)址?"))
? ? ? {
? ? ? ? ? ? var needtage = prompt("輸入網(wǎng)址", "http://idcbgp.cn/");
? ? ? ? ? ? if(needtage!=null)
? ? ? ? ? ? ?window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no");
? ? ? ? ? ? else
? ? ? ? ? ? ? alert("thanks");
? ? ? }
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>?
2017-07-06
?if(newtage==true)
? ? ?{var needtage=prompt("輸入網(wǎng)址","http://idcbgp.cn/");}
? ? if(needtage!=null)
? ? ?{window.open("needtage","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
? ? else
? ? ? {alert(thanks)}
沒(méi)有if,if,else這種寫(xiě)法,
?var newtage=confirm("是否打開(kāi)網(wǎng)該網(wǎng)址?");
? ? if(newtage==true)
?{window.open("http://idcbgp.cn/","_blank","width=400px,height=500px,menubar=no,toolbar=no")}
? else
? ? ? {alert(“thanks”)}