JS案例:通过if...else语句判断两个数中的最大值

来自CloudWiki
跳转至: 导航搜索
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>简单if语句应用案例</title>
</head>
<body>
<script type="text/javascript">
	var score=prompt("请输入成绩:");
	if(score>=90) alert("优秀");
	if(score>=70 && score<90) alert("良好");
	if(score>=60 && score<70 ) alert("合格");
	if(score<60) alert("不合格");
</script>
</body>
</html>