m0_63541669 2021-12-26 18:07 采纳率: 50%
浏览 41
已结题

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

计算不出结果


<!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>
<title>计算个人所得税</title>
  • 写回答

2条回答 默认 最新

  • ✎﹏ℳ๓敬坤 2021-12-26 18:52
    关注
    
    <!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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 12月31日
  • 已采纳回答 12月26日
  • 修改了问题 12月26日
  • 创建了问题 12月26日

悬赏问题

  • ¥15 为什么apriori的运行时间会比fp growth的运行时间短呢
  • ¥15 帮我解决一下膳食平衡的线性规划模型的数据实例
  • ¥40 万年历缺少农历,需要和阳历同时显示
  • ¥250 雷电模拟器内存穿透、寻基址和特征码的教学
  • ¥200 比特币ord程序wallet_constructor.rs文件支持一次性铸造1000个代币,并将它们分配到40个UTXO上(每个UTXO上分配25个代币),并设置找零地址
  • ¥15 关于Java的学习问题
  • ¥15 如何使用chatgpt完成文本分类任务?
  • ¥15 已知速度v关于位置s的等式,怎么转化为已知位置求速度v的等式
  • ¥15 我有个餐饮系统,用wampserver把环境配置好了,但是后端的网页却进去,是为什么,能不能帮远程一下?
  • ¥15 R运行没有名称为"species"的插槽对于此对象类"SDMmodelCV"