switch判斷成績jsp案例
阿新 • • 發佈:2017-10-31
func char switch javascrip doctype content bre turn break
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<script type="text/javascript">
function test(a){
if(isNaN(a)||a<0||a>100)return;
var content="";
var _a=parseInt(a/10)
switch(_a){
case 10:
content ="優秀";
break;
case 9:
content ="優秀";
break;
case 8:
content ="良好";
break;
case 7:
content ="一般";
break;
case 6:
content ="及格";
break;
default:
content="不及格";
}
return content;
}
document.write(test(40));
document.write(test(90));
</script>
<body>
</body>
</html>
//
switch判斷成績jsp案例