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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

設(shè)計(jì)有問(wèn)題嗎?麻煩大家給我指點(diǎn)

<!DOCTYPE html>

<html>

?<head>

? <title> new document </title> ?

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

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

? ??

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


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


? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。

? ? function openwindow(){

? ? ? ? var openpt=confirm("是否打開(kāi)新網(wǎng)頁(yè)");

? ? ? ? if(openpt==true)

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

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

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

? ? ? ? }

? ? ? ? else

? ? ? ? {

? ? ? ? ? ? alert("結(jié)束");

? ? ? ? }

? ? ? ??

? ? ? ? }else

? ? ? ? alert{"結(jié)束"};

}

? </script>?

?</head>?

?<body>?

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

?</body>

</html>


正在回答

4 回答

那段代碼是在你的代碼的基礎(chǔ)上修改的,經(jīng)測(cè)試也能運(yùn)行,如果你也看不懂的話,那再看看我簡(jiǎn)化過(guò)的代碼,還是在你的基礎(chǔ)上修改的:

<!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 openpt=confirm("是否打開(kāi)新網(wǎng)頁(yè)");

? ? ? ? if(openpt==true){

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

? ? }if(address!=null){

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

? ? ? ? }else{

? ? ? ? ? ? alert("結(jié)束");

? ? ? ? }

? ? }

?</script>?

?</head>?

?<body>?

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

?</body>

</html>

這樣寫(xiě)的話,不管你是點(diǎn)擊?confirm() 框的取消按鈕,還是點(diǎn)擊?prompt() 框的取消按鈕,都會(huì)彈出?alert("結(jié)束") 提示框。還有你說(shuō)的if同級(jí)別的問(wèn)題,在?openWindow()?這個(gè)函數(shù)里,openpt 和?address 是兩個(gè)不同的變量,在if() 條件表達(dá)式里,它們自然也不同的,所以這兩個(gè) if() 語(yǔ)句并不是同級(jí)別。還有,if(address!=null){} 語(yǔ)句最好不要放在?if(openpt==true){} 語(yǔ)句里,不然當(dāng)你點(diǎn)擊?prompt() 框的取消按鈕后,不會(huì)彈出?alert("結(jié)束") 提示框。這不符合你的設(shè)計(jì)。如果非要放便于你自己理解的話,代碼也可以像你原來(lái)的那么寫(xiě),不過(guò)你寫(xiě)的代碼真的是漏洞百出,寫(xiě)碼的時(shí)候要走點(diǎn)心?。?/p>

<!DOCTYPE html>

<html>

?<head>

? <title> new document </title> ?

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

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

? ??

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


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


? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。

? ? function openWindow(){

? ? ? ? var openpt=confirm("是否打開(kāi)新網(wǎng)頁(yè)");

? ? ? ? if(openpt==true){

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

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

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

? ? ? ? }else{

? ? ? ? ? ? alert("結(jié)束");

? ? ? ? }

? ? ? ? }else{

? ? ? ? ? ? alert("結(jié)束");

}

}

? </script>?

?</head>?

?<body>?

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

?</body>

</html>

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

你這樣的設(shè)計(jì)師沒(méi)問(wèn)題,可是寫(xiě)法就有些錯(cuò)了,你這樣寫(xiě)按鈕都打不開(kāi),這是我在你代碼的基礎(chǔ)上改過(guò)的寫(xiě)法,你對(duì)比看看:

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

? ? function openWindow(){

? ? ? ? var openpt=confirm("是否打開(kāi)新網(wǎng)頁(yè)");

? ? ? ? if(openpt==true){

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

? ? ? ? }

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

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

? ? ? ? }else if(openpt==false){

? ? ? ? ? ? alert("結(jié)束");

? ? ? ? }else if(address==null){

? ? ? ? ? ? alert("結(jié)束");

? ? ? ? }

? ? }

? </script>?

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

一只特立獨(dú)行的doge

。。哥們,你這我沒(méi)看懂啊。。。你的兩個(gè)if是同級(jí)別的,沒(méi)有嵌套,然后你后面兩個(gè)elseif也是同級(jí)別的,我沒(méi)看懂。。能不能解釋一下
2016-04-08 回復(fù) 有任何疑惑可以回復(fù)我~

語(yǔ)法:prompt(str1, str2);

參數(shù)說(shuō)明:

str1: 要顯示在消息對(duì)話框中的文本,不可修改

str2:文本框中的內(nèi)容,可以修改

默認(rèn)的地址應(yīng)該設(shè)置在promptly()中的第二個(gè)字符串中

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

var address=prompt("http://idcbgp.cn/");改為var address=prompt(”請(qǐng)輸入網(wǎng)址“,"http://idcbgp.cn/");


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

舉報(bào)

0/150
提交
取消

設(shè)計(jì)有問(wèn)題嗎?麻煩大家給我指點(diǎn)

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

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

幫助反饋 APP下載

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

公眾號(hào)

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