為啥出不來我想要的
<!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 queren=confirm("是否打開網頁");
? ? ? ? if (queren==ture)
? ? ? ? {
? ? ? ? ? ? var wocaozenmebuxing = prompt ("確認打開的網址","http://www.xianlaiwan.cn/");
? ? ? ? ? ? if( wocaozenmebuxing != null)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? window.open(wocaozenmebuxing,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? }
? ? ? ? ? ? else{}
? ? ? ? }
? ? ? ? else{}
? ? }
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2015-10-30
是true,不是ture
?var?wocaozenmebuxing?=?prompt?("確認打開的網址","http://www.xianlaiwan.cn/");這一句冒號錯了,改成英文分號
修改后的全代碼
<!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?queren=confirm("是否打開網頁"); ????????????if?(queren==true) ????????????{ ????????????????var?wocaozenmebuxing?=?prompt?("確認打開的網址","http://www.xianlaiwan.cn/"); ????????????????if(?wocaozenmebuxing?!=?null) ????????????????{ ????????????????????window.open(wocaozenmebuxing,"_blank",'width=400px,height=500px,menubar=no,toolbar=no'); ????????????????} ????????????????else{} ????????????} ????????????else{} ????????} ????</script> </head> <body> <input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/> </body> </html>2015-10-30
額。。。queren==ture ? true打錯了。。。