亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

這樣寫有錯嗎?為什么運行不了呢?

<!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==ture){

? ? ? ? ? ? var URL=prompt("請輸入網址","http://www.xianlaiwan.cn/") ? ?// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/

? ? ? ? ? ? if(prompt!=null){

? ? ? ? ? ?window.open("http://www.xianlaiwan.cn/","_blank","width=400,height=500,menubar=no,toolbar=no,scrollbars=no")} ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。

? ? ? ? ? ? else{alert("bye!")} }

? ? ? ? ? ??

? ? ? ? ?else{alert("bye!")}

? ? ? ? ?} ? ? ?

? </script>?

?</head>?

?<body>?

?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?

?</body>

</html>


正在回答

4 回答

<!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/")????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????????????if(prompt!=null){
???????????window.open("http://www.xianlaiwan.cn/","_blank,width=400,height=500,menubar=no,toolbar=no,scrollbars=no")}???//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????????????else{alert("bye!")}?}
?????????????
?????????else{alert("bye!")}
?????????}??????
??</script>?
?</head>?
?<body>?
?<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>


0 回復 有任何疑惑可以回復我~
#1

Bill0123 提問者

非常感謝!
2015-08-04 回復 有任何疑惑可以回復我~
  1. javascript語句末尾都沒加分號;

  2. windowopen("http://www.xianlaiwan.cn/","_blank","width=400,height=500,menubar=no,toolbar=no,scrollbars=no");

    這一句只能打開”http://www.xianlaiwan.cn/“,應該改為:

    windowopen(URL,"_blank","width=400,height=500,menubar=no,toolbar=no,scrollbars=no");

  3. if(){

    }

    else{

    }

    你的else語句都放在了if語句的大括號里了哦。。

  4. 標點符號一定記得換成英文輸入?。。它c符號一定記得換成英文輸入?。?!標點符號一定記得換成英文輸入?。。。ㄖ匾氖虑檎f三遍)不然后面找問題,會找到哭的~

0 回復 有任何疑惑可以回復我~
#1

Bill0123 提問者

恩恩 謝謝提醒,我剛開始學,經常會犯小錯誤 以后一定記??!^_^
2015-08-06 回復 有任何疑惑可以回復我~
#2

lt_mk 回復 Bill0123 提問者

恩恩,我也剛開始學,大家一起加油哈!
2015-08-07 回復 有任何疑惑可以回復我~

ture改成true還是不行

0 回復 有任何疑惑可以回復我~
if(open==ture){

這里是true,不是ture

var?URL=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?open=confirm("確定打開窗口?")????????//?新窗口打開時彈出確認框,是否打開
????????if(open==true){
????????????var?URL=prompt("請輸入網址","http://www.xianlaiwan.cn/")????//?通過輸入對話框,確定打開的網址,默認為?http://www.xianlaiwan.cn/
????????????if(prompt!=null){
???????????window.open("http://www.xianlaiwan.cn/","_blank","width=400,height=500,menubar=no,toolbar=no,scrollbars=no")}???//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????????????else{alert("bye!")}?}
????????????
?????????else{alert("bye!")}
?????????}??????
??</script>?
?</head>?
?<body>?
?<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>


0 回復 有任何疑惑可以回復我~
#1

Perona

嗯,這一句也有問題window.open("http://www.xianlaiwan.cn/","_blank","width=400,height=500,menubar=no,toolbar=no,scrollbars=no") 這里的冒號也是中文的,改成英文的吧。
2015-08-03 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

這樣寫有錯嗎?為什么運行不了呢?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號