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