switch判断成绩jsp案例

<!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>

//

posted @ 2017-10-31 11:54  我喜欢喝糖水  阅读(622)  评论(0编辑  收藏  举报
我喜欢喝糖水的博客友链:股票指标编程学习