首页 > 代码库 > 关于JS的两行代码,习题

关于JS的两行代码,习题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
 <script type="text/javascript">

    var score = prompt("请输入!");
    var res;  
    if(score == ""){
     
        res = "填写!";
    }else if(score == null){

        res = "取消按钮";
    }else{

                var fenshu = Number(score);
                
                if(fenshu>=0 && fenshu<=100){
                    
                    if(fenshu >=90){
                        res = "优秀";
                        
                    }else if(fenshu >=80){
                        res = "良好";
                    
                    }else if(fenshu >=70){
                        res = "中等";
                    
                    }else if(fenshu >=60){
                        res = "及格";
                    
                    }else{
                        res = "不及格!";
                    
                    }

                }else{

                    res = "用户输入数据不合法";
                    
                }    
    }
    alert(res);

     </script>



      
    
</body>

<body>
<script type="text/javascript">
    for(var ji=1;ji<35;ji++){

        var tu = 35-ji;
        if(ji*2 + tu*4 == 94){
            document.write("鸡"+ji+""+"兔子"+tu);
        }
    }
</script>

</body>
</html>

 

关于JS的两行代码,习题