可以看看为什么计算不出结果吗?

计算不出结果


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>计算个人所得税</title>
        <style type="text/css">
                body {
                    background-image:url(t4517740429689856.jpg);
                  align-items: center;
                  background-color: skyblue;
                  display: flex;
                  justify-content: center;
                  height: 100vh;
                }
                .box {
                     background-image: url(3.jpg);
                  background-color:palevioletred;
                  border-radius: 20px;
                  box-sizing: border-box;
                  height: 700px;
                  padding: 20px;
                  width: 400px;
                }
                .title {
                  color: indianred;
                  font-family: sans-serif;
                  font-size: 34px;
                  font-weight: 700;
                  margin-top: 20px;
                }
                .box2 {
                  height: 50px;
                  position: relative;
                  width: 100%;
                  }
                  .p1 {
                    margin-top: 40px;
                  }
                  .p2 {
                    margin-top: 30px;
                  }
                  .input {
                    background-color: pink;
                    border-radius: 12px;
                    border: 0;
                    box-sizing: border-box;
                    color: hotpink;
                    font-size: 25px;
                    height: 100%;
                    outline: 0;
                    padding: 4px 20px 0;
                    width: 100%;
                  }
                  .submit {
                    background-color: pink;
                    border-radius: 12px;
                    border: 0;
                    box-sizing: border-box;
                    color: indianred;
                    cursor: pointer;
                    font-size: 25px;
                    height: 50px;
                    margin-top: 38px;
                    text-align: center;
                    width: 100%;
                    -webkit-transition-duration: 0.4s; 
                        transition-duration: 0.4s;
                  }
                  .submit:hover {
                      background-color:hotpink;
                      color: white;
                  }
                  .placeholder{
                      font-size: 18px;
                      color: indianred;
                      font-weight:bold;
                  }
                 
                </style>
                
            </head>
            <body>
                <div class="box">
                <div class="title">
                    请输入你的月工资与年终奖:
                    </div>
                <div class="box2 p1">
                        <input type="text" id="monthIncome" class="input"   placeholder="月工资 " />
                      </div>
                <div class="box2 p2">
                        <input type="text" id="yearIncome" class="input"   placeholder="年终奖 " />
                        
                      </div>     
                <button type="text" class="submit" onclick="printf()">计 算 所 得 税</button>
                      <script type="text/javascript">
                      var table={
                              free:3500
                              levels:[
                                          {low:-3500,high:0,rate:0,sub:0},
                                          {low:0,high:1500,rate:0.03,sub:0},
                                          {low:1500,high:4500,rate:0.1,sub:105},
                                          {low:4500,high:9000,rate:0.2,sub:555},
                                          {low:9000,high:35000,rate:0.25,sub:1005},
                                          {low:35000,high:55000,rate:0.3,sub:2755},
                                          {low:55000,high:80000,rate:0.35,sub:5505},
                                          {low:80000,high:Number.MAX_VALUE,rate:0.45,sub:13505}
                              
                              ],
                              calcMonthTax: function(monthIncome){
                                  var left=monthIncome-this.free;
                                  var tax=0
                                  for(index in this.levels){
                                      if(left>this.levels[index].low &&left<-this.levels[index],high){
                                          tax=left*this.levels[index].rate-this.levels[index].sub;
                                      }
                                  }
                                  return tax;
                              },
                              calcYearTax:function(monthIncome,yearIncome){
                                  var nleft;
                                  var ntax=0
                                  if(monthIncome>=this.free){
                                      for(nindex in this.levels){
                                          nleft=yearIncome/12;
                                          if(nleft>this.levels[nindex].low&&nleft<=this.levels[nindex].high){
                                              ntax=yearIncome*this.levels[nindex].rate-this.levels[nindex].sub;
                                              return ntax
                                          }
                                      }
                                  }
                                  else{
                                      
                                      for(index in this.levels){
                                          yearIncome=yearIncome-(this.free-this.monthIncome)
                                          nleft=yearIncome/12;
                                          if(nleft>this.levels[index].low&&nleft<=this.levels[index].high){
                                              ntax=yearIncome*levels[index].rate-levels[index].sub;
                                              return ntax;
                                          }
                                      }
                                  }
                              }
                          };
                          function printf() {
                              var monthIncome=document.getElementById("monthIncome").value;
                              var yearIncome=document.getElementById("yearIncome").value;
                              var mtax=table.calcMonthTax(monthIncome);var ytax=table.calcYearTax(monthIncome,yearIncome);
                              var all=mmtax*12+ytaxr;
                              document.getElementById("mtax").value=mtax;
                              document.getElementById("ytax").value=ytax;
                              document.getElementById("all").value=all;
                          }
                      }
                      </script>
                <div class="box2 p2">
                        <input type="text" id="mtax" class="input"  placeholder="月税" readonly="readonly" >
                      </div>    
                       <div class="box2 p2">
                               <input type="text" id="ytax" class="input"  placeholder="年税" readonly="readonly" >
                             </div>
    <div class="box2 p2">
            <input type="text" id="all" class="input"  placeholder="全税" readonly="readonly" >
          </div>
    </body>
</html>
计算个人所得税

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>计算个人所得税</title>
        <style type="text/css">
                body {
                    background-image:url(t4517740429689856.jpg);
                  align-items: center;
                  background-color: skyblue;
                  display: flex;
                  justify-content: center;
                  height: 100vh;
                }
                .box {
                     background-image: url(3.jpg);
                  background-color:palevioletred;
                  border-radius: 20px;
                  box-sizing: border-box;
                  height: 700px;
                  padding: 20px;
                  width: 400px;
                }
                .title {
                  color: indianred;
                  font-family: sans-serif;
                  font-size: 34px;
                  font-weight: 700;
                  margin-top: 20px;
                }
                .box2 {
                  height: 50px;
                  position: relative;
                  width: 100%;
                  }
                  .p1 {
                    margin-top: 40px;
                  }
                  .p2 {
                    margin-top: 30px;
                  }
                  .input {
                    background-color: pink;
                    border-radius: 12px;
                    border: 0;
                    box-sizing: border-box;
                    color: hotpink;
                    font-size: 25px;
                    height: 100%;
                    outline: 0;
                    padding: 4px 20px 0;
                    width: 100%;
                  }
                  .submit {
                    background-color: pink;
                    border-radius: 12px;
                    border: 0;
                    box-sizing: border-box;
                    color: indianred;
                    cursor: pointer;
                    font-size: 25px;
                    height: 50px;
                    margin-top: 38px;
                    text-align: center;
                    width: 100%;
                    -webkit-transition-duration: 0.4s; 
                        transition-duration: 0.4s;
                  }
                  .submit:hover {
                      background-color:hotpink;
                      color: white;
                  }
                  .placeholder{
                      font-size: 18px;
                      color: indianred;
                      font-weight:bold;
                  }
                 
                </style>
                
            </head>
            <body>
                <div class="box">
                <div class="title">
                    请输入你的月工资与年终奖:
                    </div>
                <div class="box2 p1">
                        <input type="text" id="monthIncome" class="input"   placeholder="月工资 " />
                      </div>
                <div class="box2 p2">
                        <input type="text" id="yearIncome" class="input"   placeholder="年终奖 " />
                        
                      </div>     
                <button type="text" class="submit" onclick="printf()">计 算 所 得 税</button>
     <script type="text/javascript">
        var table={
            free:3500,
            levels:[
                {low:-3500,high:0,rate:0,sub:0},
                {low:0,high:1500,rate:0.03,sub:0},
                {low:1500,high:4500,rate:0.1,sub:105},
                {low:4500,high:9000,rate:0.2,sub:555},
                {low:9000,high:35000,rate:0.25,sub:1005},
                {low:35000,high:55000,rate:0.3,sub:2755},
                {low:55000,high:80000,rate:0.35,sub:5505},
                {low:80000,high:Number.MAX_VALUE,rate:0.45,sub:13505}
                              
            ],
            calcMonthTax: function(monthIncome){
                var left=monthIncome-this.free;
                var tax=0
                for(index in this.levels){
                    if(left>this.levels[index].low &&left<-this.levels[index].high){
                        tax=left*this.levels[index].rate-this.levels[index].sub;
                    }
                }
                return tax;
            },
            calcYearTax:function(monthIncome,yearIncome){
                var nleft;
                var ntax=0
                if(monthIncome>=this.free){
                    for(nindex in this.levels){
                        nleft=yearIncome/12;
                        if(nleft>this.levels[nindex].low&&nleft<=this.levels[nindex].high){
                            ntax=yearIncome*this.levels[nindex].rate-this.levels[nindex].sub;
                            return ntax
                        }
                    }
                }
                else{                
                    for(index in this.levels){
                        yearIncome=yearIncome-(this.free-this.monthIncome)
                        nleft=yearIncome/12;
                        if(nleft>this.levels[index].low&&nleft<=this.levels[index].high){
                            ntax=yearIncome*levels[index].rate-levels[index].sub;
                            return ntax;
                        }
                    }
                }
            }
        };
        function printf() {
            var monthIncome=document.getElementById("monthIncome").value;
            var yearIncome=document.getElementById("yearIncome").value;
            var mtax=table.calcMonthTax(monthIncome);
            var ytax=table.calcYearTax(monthIncome,yearIncome);
            var all=mtax*12+ytax;
            document.getElementById("mtax").value=mtax;
            document.getElementById("ytax").value=ytax;
            document.getElementById("all").value=all;
        }
    </script>
        <div class="box2 p2">
             <input type="text" id="mtax" class="input"  placeholder="月税" readonly="readonly" >
        </div>    
        <div class="box2 p2">
            <input type="text" id="ytax" class="input"  placeholder="年税" readonly="readonly" >
        </div>
        <div class="box2 p2">
            <input type="text" id="all" class="input"  placeholder="全税" readonly="readonly" >
        </div>
    </body>
</html>

问题具体一点,最好贴出代码