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

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

這代碼對嗎?為什么要設置函數我不理解。

<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> // 新窗口打開時彈出確認框,是否打開 function windiwopen();{ var mywin=confirm("您確認進入新網址嗎??"); if(mywin==true){ var mywi=prompt("請輸入您將要進去的網址:"); if(mywi!=null){ alert("歡迎進入"); window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500th,menubar=no,toolbar=no');} else{ alert("您需要輸入地址哦");} else{ document.write("好吧,您離開了網頁"); } }// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/ //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。 </script> </head> <body> <input type="button" value="新窗口打開網站" onclick="openWindow()" /> </body> </html>

正在回答

2 回答

<!DOCTYPE html>

?<html>?

?<head>?

?<title> new document </title>

?<meta charset="utf-8">

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

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

? ?function windiwopen()

? ?{?

? ? var mywin=confirm("您確認進入新網址嗎??");?

? ?if(mywin==true)

? ? { var mywi=prompt("請輸入您將要進去的網址:","http://www.xianlaiwan.cn/");?

? ? ? ?if(mywi!=null)

? ? ? ? ? {?

? ? ? ? ? ? alert("歡迎進入");?

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

? ? ?}?

? ?else

? ? {?

? ? ? alert("您需要輸入地址哦");

? ? }?

? }

? ?else{?

? ? ? document.write("好吧,您離開了網頁");

? ? ? ?}

? ? ?}

? ? ?</script>

? ? ? </head>?

? ? ? <body>?

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

? ? ? </body>

? ? ? ?</html>

主要是最后的函數名沒改

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

慕娘9868777 提問者

thank you
2017-07-30 回復 有任何疑惑可以回復我~
#2

子非愚96

不對啊,這個代碼用戶輸入的地址沒采用,只能打開imooc
2017-07-31 回復 有任何疑惑可以回復我~

不對,調用的函數名是openWindow(),而且在第一個else之后應該再加一個}

像這樣

<!DOCTYPE html>

<html>?

<head>

<title> new document </title>

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

<script type="text/javascript">?

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

function windowopen()

{?

? ? var mywin=confirm("您確認進入新網址嗎??");

if(mywin==true)

{?

? ? var mywi=prompt("請輸入您將要進去的網址:","http://www.xianlaiwan.cn/");

? ??

? ? if(mywi!=null){ alert("歡迎進入");

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

else{ alert("您需要輸入地址哦");} }

else{ document.write("好吧,您離開了網頁"); }

}// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/ //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。?

</script>?

</head>?

<body>?

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

</body>

</html>


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

舉報

0/150
提交
取消

這代碼對嗎?為什么要設置函數我不理解。

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

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

幫助反饋 APP下載

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

公眾號

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