請問哪里有問題?
<!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 open=confirm(是否打開此窗口?);
? ? if(open==true)
? ? {var opening=prompt("請輸入網址:","http://www.xianlaiwan.cn/")
? ? ? ? if(opening=="null")
? ? ? ? {window.open("http://www.xianlaiwan.cn/","_blank","width=400px,height=500px,menubar=no,toolbar=no");
? ? }
? ? else{alert("輸入錯誤");}
? ? else
? ? {alert("再見!");}
? ? }
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2017-05-26
function openWindow(){
? ? ? ? var a=confirm("是否打開");
? ? ? ? var b;
? ? ? ? if (a){
? ? ? ? var b=prompt("請輸入網址");
? ? ? ? alert(b);
? ? ? ? window.open(b,'_blank');
? ? ? ? }
? ? }
自己對著改吧 ? 慘不忍睹,函數的定義都不對,null也沒搞清,還有亂嵌套,看著頭大。
2017-05-26
2017-05-26
function openWindow()后面的分號就第一個要去掉