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

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

求解,真的看不出哪錯了

<!DOCTYPE html>

<html>

?<head>

? <title> new document </title>??

? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?

? <script type="text/javascript">??

function openWindow(){? ??

? ? // 新窗口打開時彈出確認框,是否打開


? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/


? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。

? ?

var message=confirm("是否需要打開網頁?");

if(message==true){

var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");

if(site!=null){?

? ? ? window.open("http://www.xianlaiwan.cn/",'_blank','width=400,height=500,menubar=no,toolbar=no)

? }else{? alert("打開失敗");? }

? ??

}

else{alert("不需要打開網頁");}


}

openWindow();

</script>?

?</head>?

?<body>?

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

?</body>

</html>


正在回答

8 回答

window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')這里的冒號

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

不應該是這樣嗎?難道是我寫錯了?

<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?
? <script type="text/javascript"> ?
?? ?
??? // 新窗口打開時彈出確認框,是否打開

??? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/

??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
??? function add(){
??????? var add=confirm("是否打開?")
??????? if(add==true)
??????? {
??????? window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,left=0,menubar=no,toolbar=no,status=no,scrollbars=yes');
??????? }
??? }
? </script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網站" onclick="add()" />
?</body>
</html>

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

兩個:http后面的是中文冒號,toolbar的no后面少一個單引號

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

http后面的冒號你輸入法錯了,用的是中文。

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

<!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 message=confirm("是否需要打開網頁?");

? if(message==true){

? ? ?var site=prompt("請輸入網址:",'');

? ? ?if(site){?

? ? ? ? window.open("http://www.xianlaiwan.cn/",'_blank','width=400,height=500,menubar=no,toolbar=no');

? ? ?}else{

? ? ? alert("打開失敗"); ?

? ? ?}

? }

} ?

</script>?

</head>?

<body>?

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

</body>

</html>


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

<!DOCTYPE html>
<html>
<head>
?<meta charset="UTF-8">
?<title>Document</title>
?<script type="text/javascript">?
??function openWindow(){???
????? // 新窗口打開時彈出確認框,是否打開????? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/????? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
????
???var message=confirm("是否需要打開網頁?");
???if(message==true){
????var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");
????if(site!=null){
?????window.open("https://www.baidu.com/",'_blank','width=400,height=500,menubar=no,toolbar=no');
????}else{
?????alert("打開失敗");?
????}
???}
???else{
????alert("不需要打開網頁");
???}
??}
??openWindow();
?</script>
</head>
<body>
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />
</body>
</html>

是? https ,不是 http 。測試的時候用的 百度 ,窗口 長寬高 無法規定。

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

瞅瞅啥 提問者

還是不行誒,按鈕沒反應
2018-09-19 回復 有任何疑惑可以回復我~

<!DOCTYPE html>

<html>

?<head>

? <title> new document </title>??

? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>? ?

? <script type="text/javascript">??

function openWindow(){? ??

? ? // 新窗口打開時彈出確認框,是否打開


? ? // 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/


? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。

? ?

var message=confirm("是否需要打開網頁?");

if(message==true){

var site=prompt("請輸入網址:"," http://www.xianlaiwan.cn/");

if(site!=null)

? {?

? ? ? window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')

? }


else

? {? alert("打開失敗");? }


}else{alert("不需要打開網頁");}

</script>?

?</head>?

?<body>?

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

?</body>

</html>


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

瞅瞅啥 提問者

還是不行哦
2018-09-18 回復 有任何疑惑可以回復我~

toolbar=no 后面缺個引號吧

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

舉報

0/150
提交
取消

求解,真的看不出哪錯了

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

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

幫助反饋 APP下載

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

公眾號

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