js(if else)分数等级查询

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
<link rel="stylesheet" href="imooc.css" type="text/css">
<script src="https://www.imooc.com/static/lib/jquery/1.9.1/jquery.js"></script>
<style type="text/css">
  span{color:red;}
  .a{color:red;}
  div{font-size:50px;
      color:#00ffff;
      font-family:"楷体"}
 </style>
</head>
<body>
    <h1>我的第一个HTML页面</h1>
    <p>我的第一个段落。</p >
 <form id="form1" runat ="server">
<input type ="text" id="txbInfo" name="txbInfo"  style="80px;" />
<input type ="button" id="btnGet" name="btnGet" value="查询分数等级" />
  </form>

   <div class="score"></div>

    <script type="text/javascript">document.write("a")</script>
    <script type="text/javascript" class="a">
      var h=("<div>hello</div>")
      document.write(h+"<span style='white-space:pre;'>"+"1      2          3    a" + "</span>")
  </script>
    <script type="text/javascript" >$(".a").css("color","red")</script>
  <script type="text/javascript">
    $("#btnGet").click(function(){
    var score=$("#txbInfo").val();
    // if(score>=80){document.write("优秀")}
    // else if(score>=70){document.write("中等")}
    // else if(score>=60){document.write("及格")}
    // else {document.write("不及格")};
   
    if(score>=80){
        $('.score').html("优秀")
    }
    else if(score>=70){
        $('.score').html("中等")
    }
    else if(score>=60){
        $('.score').html("及格")
    }
    else {
        $('.score').html("不及格")
    };
    })
   
  </script>
  
</body>
</html>

红尘往事,一切随风!
原文地址:https://www.cnblogs.com/xwenwu/p/13630027.html