function addValue(value1,value2){
if(value1=="")value1="0";
if(value2=="")value2="0";
var temp1=0;
var temp2=0;
if(value1.indexOf(".")!=-1)
temp1=value1.length - value1.indexOf(".")-1;
if(value2.indexOf(".")!=-1)
temp2=value2.length - value2.indexOf(".")-1;

var temp=0;

if(temp1>temp2)
temp = (parseFloat(value1)+parseFloat(value2)).toFixed(temp1);
else
temp = (parseFloat(value1)+parseFloat(value2)).toFixed(temp2);

document.getElementById('test3').value= temp;

}

相关文章:

  • 2021-10-06
  • 2021-11-02
  • 2021-11-17
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
猜你喜欢
  • 2021-10-23
  • 2021-10-30
  • 2021-06-02
  • 2022-12-23
  • 2021-09-02
  • 2022-01-02
相关资源
相似解决方案