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

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

運(yùn)行不出來(lái)

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

?function my(){

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

if(a==true){ var b=prompt("http://idcbgp.cn/");}

?if(b!=null){window.open('http://idcbgp.cn',width=400,height=500

,menubar=no,toolbar=0;);}

? else

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

?</script>?

?</head>??<body>?

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

</body></html>

直接懵掉了,請(qǐng)求大神指點(diǎn)

正在回答

4 回答

或者把你的代碼改成這樣,記住window.open 函數(shù),設(shè)置窗口屬性的參數(shù)是有引號(hào)的

<script type="text/javascript">
? ?function my(){
? ? ? ?var a=confirm("是否打開(kāi)新網(wǎng)頁(yè)?");
? ? ? ?var b;
? ? ? ?if(a==true){
? ? ? ? ? ?b=prompt("http://idcbgp.cn/");
? ? ? ?}
? ? ? ?if(b!=null){
? ? ? ? ? ?window.open('http://idcbgp.cn',"width=400,height=500,menubar=no,toolbar=0");
? ? ? ?} else {
? ? ? ? ? ?alert("結(jié)束 ");
? ? ? ?}
? ? ? ?}
</script>
</head> ?<body>
<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="my()" />
</body></html>

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

不知道你要干嘛,是要判斷用戶(hù)輸入打開(kāi)一個(gè)新的窗口嗎?

<script type="text/javascript">?

?function my(){

var a=confirm("是否打開(kāi)新網(wǎng)頁(yè)?"); ?//詢(xún)問(wèn)是否要打開(kāi)窗口

if(a){?

????//a 的返回值只要兩種結(jié)果true flase ?,直接使用就可以

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

? ? ? if(b!=null){

????????//不管輸入什么內(nèi)容,只要有輸入就打開(kāi)下面的地址

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

? ? ? }else{

? ? ?//如果b的值為null ,用戶(hù)什么也沒(méi)有輸入

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

? ? ?}

}else{

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

}

?</script>?

?</head>??<body>?

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

</body></html>


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

<script type="text/javascript">?

?function my(){

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

if(a==true){ var b=prompt("http://idcbgp.cn/");

?if(b!=null){window.open('http://idcbgp.cn',width=400,height=500

,menubar=no,toolbar=0);}

? else

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

}else{

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

?</script>?

?</head>??<body>?

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

</body></html>


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

你把邏輯整錯(cuò)了,if語(yǔ)句中嵌套了ifelse語(yǔ)句的,你仔細(xì)檢查一下。

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

慕田峪0611318 提問(wèn)者

哦~明白了,謝謝嘻嘻
2017-04-08 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
JavaScript入門(mén)篇
  • 參與學(xué)習(xí)       741081    人
  • 解答問(wèn)題       9811    個(gè)

JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門(mén)

進(jìn)入課程

運(yùn)行不出來(lái)

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

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

幫助反饋 APP下載

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

公眾號(hào)

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