老师,麻烦帮我看一下应该怎么改?
来源:1-8 编程练习
慕9588112
2019-06-15 20:29:54
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> </style> </head> <body> <script> var score=prompt("请输入学生的成绩:"); if(score<0 && score>100){ alert("成绩输入错误"); }else{ if(score<60){ alert("不及格!"); }else if(score>=60 && score<=69){ alert("及格!"); }else if(score>=70 && score<=79){ alert("一般"); }else if(socre>=80 && score<=89){ alert("良好!"); }else{ alert("优秀"); } } </script> </body> </html>
只有不及格、及格和一般可以实现效果,
输入的限制条件<0,>100不起作用.
输入大于80以后浏览器没反应
输入小于0的话直接跳到不及格
1回答
同学你好,
1、是判断条件写错了。
小于0并且大于100的数字是不存在的,只要满足一个条件就可以判定为成绩输入错误,所以把&&修改成||就可以了。
2、输入大于80以后浏览器没反应是因为单词拼写错误。正确拼写应该是score。
如果帮助到了你,欢迎采纳~祝学习愉快。