Asa-Zhu

< form id = "form1" name = "form1" method = "post" action = "" >

 < label >

 < input type = "text" name = "t1" /><input type="text" name="t2" />

< input type = "text" name = "t3" /> <input type="button" name="Submit" value="计算" onclick="js();" />

 </label>

 </form >

< script >

 function js() {  

   form1.t2.value = formatFloat(form1.t1.value / 100 * 90, 4);  

   form1.t3.value = formatFloat(form1.t1.value / 100 * 10, 4);

}

 function formatFloat(src, pos) {  

   return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);

}

 </script>

分类:

技术点:

相关文章:

  • 2021-11-02
  • 2017-11-30
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-06
  • 2021-11-25
  • 2021-06-25
  • 2022-02-04
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案