點擊按鈕沒反應,求高手看看錯在哪里
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>?
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>??
? <script type="text/javascript">?
??? function openWindow()
?{
??var open=confirm("確定打開新的窗口");
???if(open=true)
????{?
????var url=prompt("打開輸入的網(wǎng)址","www.baidu.com");
????if (url!=null)
?????{
?????window.open(url"_blank");
?????? ?}
????else
?????{
?????alert("88");
?????}
????}
???else
????{
????alert("再見");
????}
?}
</script>
?</head>
?<body>
?<form>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()">
????? </form>
</html>
2018-05-28
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>??
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>???
? <script type="text/javascript">??
??? function openWindow()
?{
??var open=confirm("確定打開新的窗口");
???if(open=true)
????{?
????var url=prompt("打開輸入的網(wǎng)址","www.baidu.com");
????if (url!=null)
?????{
?????window.open(url"_blank");
?????? ?}
????else if
?????{
?????alert("88");
?????}
???else?
????{
????alert("再見");
????}
?}
</script>?
?</head>?
?<body>?
?<form>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()">
????? </form>
</html>
2018-05-28
你的第二個else應該是else if,后面還多寫了一個}