多判断点试试,JavaScript就是好玩!
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>prompt</title> <script language="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 == null) { document.write("你怎么取消了呢?"); } else if(score == '') { document.write("亲,忘记输入成绩吧!"); } else if(score<=60) { document.write("要努力了!"); } else { document.write("输入不对哦!"); } } </script> </head> <body> <form> <input name="button" type="button" onClick="rec()" value="点击我,对成绩做评价!"> </form> </body> </html>