<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>if练习1</title>
<script type="text/javascript">
var score = prompt("请输入小明的期末成绩(0-100):");
if(score > 100 || score < 0 || isNaN(score)){
alert("不合法");
}else{
if(score == 100){
alert("奖励一辆BMW");
}else if(score >= 80){
alert("奖励一台iphone15s");
}else if(score >= 60){
alert("奖励一本参考书");
}else{
alert("什么奖励也没有");
}
}
</script>
</head>
<body>
</body>
</html>
网友评论