<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
</head>
<body>
<input type="text" id="cj" placeholder="输入整数"/>
<input type="button" onclick="fun()" value="确定"/>
<h1 id="jg">结果为:</h1>
<script type="text/javascript">
var result=document.getElementById("jg");
function fun (){
var a=document.getElementById("cj").value;
/*if嵌套==============================================*/
/*if(a<=90)
if(a<=80)
if(a<=60)
result.innerHTML="不合格";
else
result.innerHTML="合格";
else
result.innerHTML="良好";
else
result.innerHTML="优秀";*/
/* else嵌套====================================*/
/*if(a<60)
result.innerHTML="不合格";
else if(a<=80)
result.innerHTML="合格";
else if(a<=90)
result.innerHTML="良好";
else result.innerHTML="优秀";*/
/* if else 嵌套========================================*/
if(a<=80)
if(a<=60)
result.innerHTML="不合格";
else result.innerHTML="合格";
else if(a<=90)
result.innerHTML="良好";
else result.innerHTML="优秀";
}
</script>
</body>
</html>