引导3模态上的提交按钮在Android上不起作用

时间:2019-03-01 21:41:30

标签: javascript bootstrap-modal

我有一个模态对话框,用于计算人的bmi。

当我们点击“提交”按钮时,它将结果放置在“提交”按钮下方的

<span id=result></span> 

标签。但是,这在chrome中可以正常工作,但在android中,它甚至不接受它出现的提交。

这是我下面的模态代码:

 <!-- Modal -->
    <div id="myModal" class="modal fade" 
    role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" 
    class="close" data- 
   dismiss="modal">&times;</button>
          <h4 class="modal-title">BMI 
    Calculator</h4>
        </div>
        <div class="modal-body">         

          <form>
              <a>Enter your weight (kg): 
   </a>
            <input type="number"  id="weight"  min="1" max="200" step="10" 
            placeholder="--" />
            <br />
            <br />
            <a>Enter your height (cm):</a>
            <input type="number"  
    id="height"  min="1" max="300" 
    step="10" 
            placeholder="---" />
            <br />
            <br />   

            <input class="btn btn-form" 
    class="submit" type="button" 
    value="Submit" onclick="bmi()" />
            <br />
            <br />
            <span id="result">Here will be 
    your result</span>
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn 
    btn-default" data- 
   dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div> 

这是我的以下JavaScript代码:

Number(document.getElementById("height").va 
   lue);
  var weight = Number(document.getElementById("weight").value);
  var result = weight / (height/100 * height/100);
  alert("TEST");
  document.getElementById("result").innerHTML = "Your bmi score is : " + Math.round(result);
  }

0 个答案:

没有答案