煩請各位大神再來看下這里哪出錯了,運行不了
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
function foo(){
? ? var bli=confirm('確定打開新世界的大門嗎?');
? ? if (bli==ture)
? ? ? ? ? ? {var url=prompt("在下面網址輸入key就可以啦",'http://www.bilibili.com/');
? ? ? ? ? ? if (url!=null)
? ? ? ? ? ? {window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');}
? ? ? ? else {alert('prompt關閉');}
? ? else {alert('confirm關閉');}
? ? }}
? </script>?
?</head>?
?<body>?
?<input type="button" value="打開新世界的大門" onclick="foo()" />?
?</body>
</html>
2016-10-16
第一:if語句里面應該是true而不是ture;
第二:prompt語句后面的分號要是英文輸入下的,你用的是中文狀態下的了;
第三:第一個else后面應該跟一個分號表示第一個if語句結束,你把它放到最后去了
2016-10-17
<!DOCTYPE?html> <html> ?<head> ??<title>?new?document?</title>?? ??<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/>??? ??<script?type="text/javascript">?? function?foo(){ ????var?bli=confirm('確定打開新世界的大門嗎?'); ????if?(bli==true)//這里ture改為true ????????????{var?url=prompt("在下面網址輸入key就可以啦",'http://www.bilibili.com/');/*這里改為英文狀態下的*/ ????????????if?(url!=null) ????????????{window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');} ????????else?{alert('prompt關閉');}}//這里加上一個括號 ????else?{alert('confirm關閉');} ????}//這里去掉一個括號 ??</script>? ?</head>? ?<body>? ?<input?type="button"?value="打開新世界的大門"?onclick="foo()"?/>? ?</body> </html>2016-10-16
上面說得都對,嘻嘻
2016-10-16
??content="text/html"?charset="gbk"/
?if(bil?!=?null)
2016-10-16
<!DOCTYPE?html> <html> ?<head> ??<title>?new?document?</title>?? ??<meta?http-equiv="Content-Type"?content="text/html"?charset="gbk"/>??? ??<script?type="text/javascript">? function??foo() ??????{ ????var?bil?=confirm("是否打開大門"); ?????if(bil?==?true){ ????var?url?=?prompt("要去玩嗎?","http://www.bilibili.com");} ?????if(bil?!=?null) ????{window.open(url,'_blank','width:400,height:500,menubar=no,toolbar=no');} ???else? {alert("關閉");}?? ???} </script> </head> <body> <input?type="button"?value="打開新世界的大門"?onclick="?foo()"?/>?</body> </html>2016-10-16
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
多個)號