點(diǎn)擊按鈕取消,如何不出現(xiàn)提示框
????<!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變量,用來(lái)存儲(chǔ)用戶輸入的成績(jī)值。
???? score =prompt();
????? ? if(isNaN(score))
???? {
???? ? alert("請(qǐng)輸入數(shù)字");
????? }
????? ? else if(score<=0 || score>100)
???? {
???? alert("成績(jī)是0-100,請(qǐng)重新輸入");
????? ? }
???? else if(score>80)
???? {
???? alert("牛逼");
???? }
????? ? else if(score>60)
???? {
???? alert("可以");
???? }
????? ? else
???? {
???? alert("是個(gè)人才");
???? }
????? }
????? </script>
????</head>
????<body>
????? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績(jī)做評(píng)價(jià)!" />
????</body>
????</html>
????
2020-08-26
<!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變量,用來(lái)存儲(chǔ)用戶輸入的成績(jī)值。
score =? prompt("請(qǐng)輸入你的成績(jī)")? ? ? ? ? ? ? ;
if(score!=null) {
if(score>=90)
{
? ?document.write("你很棒!");
}
else if(score>=75)
? ? {
? ?document.write("不錯(cuò)吆!");
}
else if(score>=60)
? ? {
? ?document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
}
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績(jī)做評(píng)價(jià)!" />
</body>
</html>
2020-05-07
<!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變量,用來(lái)存儲(chǔ)用戶輸入的成績(jī)值。
score =prompt("請(qǐng)輸入你的成績(jī):");
if(score>=90)
{
? ?document.write("你很棒!");
}
else if(score>=75)
? ? {
? ?document.write("不錯(cuò)吆!");
}
else if(score>=60)
? ? {
? ?document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績(jī)做評(píng)價(jià)!" />
</body>
</html>
2020-05-07
為什么呢,看提示就知道被你的判斷給攔下了。
2020-04-17
? <!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變量,用來(lái)存儲(chǔ)用戶輸入的成績(jī)值。
? ? ? ? ? ? ? score = prompt();
? ? ? ? ? ? ? if (score != null && score != "") {
? ? ? ? ? ? ? ? ? if (isNaN(score)) {
? ? ? ? ? ? ? ? ? ? ? alert("請(qǐng)輸入數(shù)字");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score <= 0 || score > 100) {
? ? ? ? ? ? ? ? ? ? ? alert("成績(jī)是0-100,請(qǐng)重新輸入");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score > 80) {
? ? ? ? ? ? ? ? ? ? ? alert("牛逼");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score > 60) {
? ? ? ? ? ? ? ? ? ? ? alert("可以");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? ? alert("是個(gè)人才");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? }
? ? ? ? ? }
? ? ? </script>
? ? </head>
? ? <body>
? ? ? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績(jī)做評(píng)價(jià)!" />
? ? </body>
? ? </html>