html 用户输入成绩,程序输出相应的成绩等级
详细代码
<! DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" / >
<head>
<title>成绩</title>
<script language="javascript">
var str=prompt("请输入成绩:");
var score=parseInt(str);
while (score<0||score>100)
{
alert("成绩范围是0~100!");
str=prompt("请输入成绩:");
score=parseInt(str);
}
if (score>90)
{
alert("优秀");
}
else if (score>80)
{
alert("良好");
}
else if (score>70)
{
alert("中等");
}
else if (score>60)
{
alert("及格");
}
else
{
alert("不及格");
}
</script>
</head>
<body>
</body>
</html>
效果图
最近这几篇前端博客,可能会与其他朋友写得有所相同,因为都是在分享一些html代码。如果我的博客对其他朋友造成影响,请联系我删除!!