我的代碼這樣寫有什么問題嗎,為什么不對?
<!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 url=prompt("通過輸入對話框,確定打開的網址","http://www.xianlaiwan.cn");
? ? ? ? if(url!=null){window.open(url,"_blank""width:400,height:500,menubar=no,toolbar=no");}
? ? ? ? else{alert("再見!");}
? ? ? ? }
? ? ? ? else{alert("再見!");}
? ? ? ? }
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2015-12-02
open==true ?是一個等號 ?
2015-11-27
你的代碼中錯誤很多,我改好了,你復制,粘貼運行一下看看吧
<!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("通過輸入對話框,確定打開的網址","http://www.xianlaiwan.cn") ????????} ????????if(url!=null){ ??????????window.open(url,"_blank","width:400,height:500,menubar=no,toolbar=no"); ????????} ????????else{alert("再見!");} ??} ??</script>? ?</head>? ?<body>? ?<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>? ?</body> </html>