點擊按鈕取消,如何不出現提示框
????<!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(isNaN(score))
???? {
???? ? alert("請輸入數字");
????? }
????? ? else if(score<=0 || score>100)
???? {
???? alert("成績是0-100,請重新輸入");
????? ? }
???? else if(score>80)
???? {
???? alert("牛逼");
???? }
????? ? else if(score>60)
???? {
???? alert("可以");
???? }
????? ? else
???? {
???? alert("是個人才");
???? }
????? }
????? </script>
????</head>
????<body>
????? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
????</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變量,用來存儲用戶輸入的成績值。
score =? prompt("請輸入你的成績")? ? ? ? ? ? ? ;
if(score!=null) {
if(score>=90)
{
? ?document.write("你很棒!");
}
else if(score>=75)
? ? {
? ?document.write("不錯吆!");
}
else if(score>=60)
? ? {
? ?document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
}
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
</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變量,用來存儲用戶輸入的成績值。
score =prompt("請輸入你的成績:");
if(score>=90)
{
? ?document.write("你很棒!");
}
else if(score>=75)
? ? {
? ?document.write("不錯吆!");
}
else if(score>=60)
? ? {
? ?document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
</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變量,用來存儲用戶輸入的成績值。
? ? ? ? ? ? ? score = prompt();
? ? ? ? ? ? ? if (score != null && score != "") {
? ? ? ? ? ? ? ? ? if (isNaN(score)) {
? ? ? ? ? ? ? ? ? ? ? alert("請輸入數字");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score <= 0 || score > 100) {
? ? ? ? ? ? ? ? ? ? ? alert("成績是0-100,請重新輸入");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score > 80) {
? ? ? ? ? ? ? ? ? ? ? alert("牛逼");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else if (score > 60) {
? ? ? ? ? ? ? ? ? ? ? alert("可以");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? ? alert("是個人才");
? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? }
? ? ? ? ? }
? ? ? </script>
? ? </head>
? ? <body>
? ? ? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
? ? </body>
? ? </html>