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

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

prompt 消息對(duì)話框 不輸入、亂輸入,怎樣提示并恢復(fù)對(duì)話?

<!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變量,用來存儲(chǔ)用戶輸入的成績值。
?? ?score = prompt("輸入你的成績:");?????????????? ;
?? ?if(score>=90)
?? ?{
?? ??? document.write("你很棒!");
?? ?}
?? ?else if(score>=75)
??? {
?? ??? document.write("不錯(cuò)吆!");
?? ?}
?? ?else if(score>=60)
??? {
?? ??? document.write("要加油!");
??? }

?? else if(score= )? {}?? //我不輸入任何值or我亂輸入,怎樣提示用戶不要亂玩,并恢復(fù)對(duì)話?
??? else
?? ?{
?????? document.write("要努力了!");
?? ?}
? }
? </script>
</head>
<body>
??? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!" />
</body>
</html>

正在回答

3 回答

<!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變量,用來存儲(chǔ)用戶輸入的成績值。

score = ?prompt("請(qǐng)輸入你的成績"); ? ? ? ? ? ? ?;

if(score>=90&&score<100)

{

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

}

else if(score>=75&&score<90)

? ? {

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

}

else if(score>=60&&score<75)

? ? {

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

? ? }

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

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

}

? ? else{

? ? ? ? document.write("你輸入的數(shù)字無效請(qǐng)刷新重試!");

? ? }

? }

? </script>

</head>

<body>

? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!" />

</body>

</html>

//這樣可以嗎?

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

雷叔愛吃各種面 提問者

非常感謝!
2016-11-22 回復(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 zhengcflag,score; //score變量,用來存儲(chǔ)用戶輸入的成績值。

? ? do

? ? { ??

? ? ? ? zhengcflag=true;

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

? ? ? ? if(score>=90)

? ? ? ? {

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

? ? ? ? }

? ? ? ? else if(score>=75)

? ? ? ? {

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

? ? ? ? }

? ? ? ? else if(score>=60)

? ? ? ? {

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

? ? ? ? }

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

? ? ? ? {

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

? ? ? ? }

? ? ? ? else?

? ? ? ? {

? ? ? ? ? ?zhengcflag=false;

? ? ? ? ? ?document.write("重新輸入!");

? ? ? ? }

? ? }

? ? while(zhengcflag==false)

? }

? </script>

</head>

<body>

? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!" />

</body>

</html>

設(shè)個(gè)標(biāo)志判斷是否正常輸入,剛剛寫的時(shí)候0<=score&&score<60忘了寫&&,把我瀏覽器弄崩潰了,無語

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

雷叔愛吃各種面 提問者

lol,謝謝
2016-11-22 回復(fù) 有任何疑惑可以回復(fù)我~

var reg = new RegExp("^\\d+$");

if (!reg.test(score)) {

alert("請(qǐng)輸入數(shù)字");

rec();

return;

}

if (score.length >= 3) {

alert("請(qǐng)輸入正確數(shù)字");

rec();

return;

}


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

舉報(bào)

0/150
提交
取消

prompt 消息對(duì)話框 不輸入、亂輸入,怎樣提示并恢復(fù)對(duì)話?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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