請教大神為何運行之后沒反應(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("是否確定點擊?");?
? ? if(mychar==true)
? ? {var myurl=prompt("請輸入你的網(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="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2021-12-20
代碼粘貼到自己的代碼編輯器里面去調(diào)試, 運行網(wǎng)頁打開F12調(diào)? 報錯一下就看出來了...
2021-09-17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
function openwindow(){
var URL = prompt("請輸入你的網(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("未打開窗口")}
}
function openwindowYN(){
var imooc = 'http://idcbgp.cn/';
var YN = confirm("確認(rèn)新建窗口打開網(wǎng)站嗎?");
if (YN==true){openwindow()}
else{alert("未打開窗口")}
}
</script>
</head>
<body>
<form action="../" method="post">
<input type="button" value="新窗口打開網(wǎng)站" onclick="openwindowYN()"/>
</form>
/*就看出來你在你的函數(shù)哪里少了一個}? 你這代碼有毒。你仔細想想重寫一個把*/
</body>
</html>