請(qǐng)教大神為何運(yùn)行之后沒(méi)反應(yīng)?
<!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 mychar=confirm("是否確定點(diǎn)擊?");?
? ? if(mychar==true)
? ? {var myurl=prompt("請(qǐng)輸入你的網(wǎng)址:","http://idcbgp.cn/");
? ? ?if (myurl!=null)
? ? ? ?{ window.open(myurl,'_blank','width=400px,height=500px,menubar=no,toolbar=no');}
? ? ?else
? ? ? ?{alert("88");}
? ? else
? ? ? ?{alert("88");}?
? ? }
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2021-12-20
代碼粘貼到自己的代碼編輯器里面去調(diào)試, 運(yùn)行網(wǎng)頁(yè)打開(kāi)F12調(diào)? 報(bào)錯(cuò)一下就看出來(lái)了...
2021-09-17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
function openwindow(){
var URL = prompt("請(qǐng)輸入你的網(wǎng)址或選擇默認(rèn)網(wǎng)址", 'http://idcbgp.cn')
if (URL!=null){
window.open(URL,"_blank"," menubar=yes,toolbar=no,scrollbars=yes,width=400,height=500");
// window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes,? width=400, height=400");
}
else{alert("未打開(kāi)窗口")}
}
function openwindowYN(){
var imooc = 'http://idcbgp.cn/';
var YN = confirm("確認(rèn)新建窗口打開(kāi)網(wǎng)站嗎?");
if (YN==true){openwindow()}
else{alert("未打開(kāi)窗口")}
}
</script>
</head>
<body>
<form action="../" method="post">
<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openwindowYN()"/>
</form>
/*就看出來(lái)你在你的函數(shù)哪里少了一個(gè)}? 你這代碼有毒。你仔細(xì)想想重寫(xiě)一個(gè)把*/
</body>
</html>