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

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

求大神解釋一下。第一次對話框 輸入空白,跳出重新輸入對話框,輸入正確值后,else if 不執(zhí)行,沒有反應(yīng)。求大神解釋一下。

<!DOCTYPE HTML>

<html>

<head>

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

<title>prompt</title>

? <script type="text/javascript">

? function rec(){

var score; //score變量,用來存儲用戶輸入的成績值。

score = prompt("請輸入你的成績:")??

? if(score>=90)

{

? ?document.write("你很棒!");

}

else if(score==null||score<0)

? ? {

? ? ? ? alert=prompt("請重新輸入");

? ? }? ?;

else if(score>=75)

? ? {

? ?document.write("不錯吆!");

}

else if(score>=60)

? ? {

? ?document.write("要加油!");

? ? }

? }

? </script>

</head>

<body>

? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />

</body>

</html>


正在回答

7 回答

else if(score==null||score<0)

? ? {

? ? ? ? alert=prompt("請重新輸入");

? ? }?

你這步將重新輸入的值賦值給了變量 alert,當(dāng)然就沒辦法再用 if 語句判斷變量 score 的值了哦!

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

score = prompt("請輸入你的成績:")? ? ??

這邊少個分號

{

? ? ? ? alert=prompt("請重新輸入");

? ? }? ?;

這邊又多個分號

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

我這邊試了 你的代碼沒問題鴨

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

<!DOCTYPE HTML>

<html>

<head>

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

<title>prompt</title>

? <script type="text/javascript">

? function rec(){

var score; //score變量,用來存儲用戶輸入的成績值。

score = prompt("輸入你的成績:","score");


if(score>=90)

{

? ?document.write("你很棒!");

}

else if(score>=75)

? ? {

? ?document.write("不錯吆!");

}

else if(score>=60)

? ? {

? ?document.write("要加油!");

? ? }

? ? else if(score<60&&score>0)

{

? ? ? ?document.write("要努力了!");

}

else

{

alert("請重新輸入");

}

? }

? </script>

</head>

<body>

? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />

</body>

</html>


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

function rec() {

var score; //score變量,用來存儲用戶輸入的成績值。

score = prompt("請輸入你的成績:");

if (score >= 90) {

document.write("你很棒!");

} else if (score == null || score < 0) {

alert = prompt("請重新輸入");

} else if (score >= 75) {

document.write("不錯吆!");

} else if (score >= 60) {

document.write("要加油!");

} else {

document.write("太差了,從頭再來吧!");

}

}

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

weixin_慕碼人8197765

已經(jīng)有>=60了
2019-01-22 回復(fù) 有任何疑惑可以回復(fù)我~

你測試的時候輸入的分數(shù)在0-60分之間吧?你沒有寫如果在這個區(qū)間要怎么做

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

?{

? ? ? ? alert=prompt("請重新輸入");

? ? }? ?;

你這句后面多了分號呀,去掉

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

別比比 提問者

去掉還是沒有反應(yīng)~
2019-01-16 回復(fù) 有任何疑惑可以回復(fù)我~
#2

try3994680 回復(fù) 別比比 提問者

回復(fù)一下看看
2019-05-09 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

求大神解釋一下。第一次對話框 輸入空白,跳出重新輸入對話框,輸入正確值后,else if 不執(zhí)行,沒有反應(yīng)。求大神解釋一下。

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

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

幫助反饋 APP下載

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

公眾號

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