第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

為什么連確認(rèn)框都沒有彈出?

<!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 mywin=confirm("是否打開網(wǎng)頁?");

? ? ? ? if(mywin==true)

? ? ? ?{

? ? ? ? var url=prompt("http://idcbgp.cn/");?

? ? ? ? if(url!=null)

? ? ? ?{ ? ? ? ?

? ? ? ?window.open(url,"_blank","width=400","height=500","menubar=no","toolbar=no");

? ? ? ?}

? ? ? ? ? ?else

? ? ? ? {

? ? ? ? ? ? alert("再見!");

? ? ? ? ? ??

? ? ? ? }

? ? ? ? ? ?else

? ? ? ?{

? ? ? ? ? ?alert("再見!");

? ? ? ? ? ?

? ? ? ?}


? ? ? ?}

? ? ? ?

? ? ? ??

? ? }//新窗口打開時彈出確認(rèn)框,是否打開


? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/


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

? ??

? ??

? </script>?

?</head>?

?<body>?

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

?</body>

</html>


正在回答

4 回答

因為你第一個if(mywin==true)判斷的大括號把else括進(jìn)去了,導(dǎo)致JavaScript語句出錯,然后就全都不會執(zhí)行了。

function openWindow(){

? ? ? ? var mywin=confirm("是否打開網(wǎng)頁?");

? ? ? ? if(mywin==true)

? ? ? ? {

? ? ? ? ? ? var url=prompt("http://idcbgp.cn/");?

? ? ? ? ? ? if(url!=null)

? ? ? ? ? ? {? ? ? ? ?

? ? ? ? ? ? ? ? window.open(url,"_blank","width=400","height=500","menubar=no","toolbar=no");

? ? ? ? ? ? }

? ? ? ? ? ? else

? ? ? ? ? ? {

? ? ? ? ? ? ? ? alert("再見!");

? ? ? ? ? ? }

? ? ? ? }//你就是這個大括號放錯地方了

? ? ? ? else

? ? ? ? {

? ? ? ? ? ?alert("再見!");

? ? ? ? }??

? ? }

修改結(jié)果是這樣

1 回復(fù) 有任何疑惑可以回復(fù)我~

已解決多謝

0 回復(fù) 有任何疑惑可以回復(fù)我~

<!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 myself=confirm("是否打開網(wǎng)頁?");

? ? ? ? if (myself==true)

? ? ? ? ? ? {

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

? ? ? ? ? ? }

? ? ? ? else

? ? ? ? ? ? {

? ? ? ? ? ? ? ? window.close();

? ? ? ? ? ? }

? ? ? ? }

? </script>?

?</head>?

?<body>?

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

?</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_慕的地1326435

參考一下,我第一次做也是后面發(fā)現(xiàn)是if沒有呼出,是白字所以無效,就把if那段刪了重寫,就可以了,另外網(wǎng)址也有問題,空白的,可以用上一章的網(wǎng)址
2019-11-21 回復(fù) 有任何疑惑可以回復(fù)我~
#2

方木學(xué)長

你的代碼也不行,點擊取消按鈕應(yīng)該不做任何操作,可你寫的代碼,直接把當(dāng)前網(wǎng)頁關(guān)閉
2019-11-23 回復(fù) 有任何疑惑可以回復(fù)我~

可以看到啊,會不會是瀏覽器的問題?

我的代碼,你試試:

<!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 myconfirm=confirm("是否打開?");

? ? // 新窗口打開時彈出確認(rèn)框,是否打開

if(myconfirm)

{

? ? var myprompt=prompt("請輸入網(wǎng)址:","http://idcbgp.cn");

? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/

window.open(myprompt,"_blank","width=400,height=500,menubar=no,toolbar=no");

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

}? ?

? }? ?

? </script>?

?</head>?

?<body>?

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

?</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

方木學(xué)長

你的代碼有bug,在輸入框里點擊取消按鈕,不應(yīng)該跳出一個頁面
2019-11-23 回復(fù) 有任何疑惑可以回復(fù)我~
#2

方木學(xué)長

if(myconfirm) { var myprompt=prompt("請輸入網(wǎng)址:","http://idcbgp.cn"); // 通過輸入對話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/ if(my prompt!=null){ window.open(myprompt,"_blank","width=400,height=500,menubar=no,toolbar=no"); //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。 } }
2019-11-23 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么連確認(rèn)框都沒有彈出?

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號