Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i am working with php ,i need to how to round off number upto two decimcal place.i want that after multiplication of two number ,when this result is used further it will take upto two decimal place ,i am working dynmically in javascripting here is the code

<script>
   function getText3(){
      var in1=document.getElementById('in1').value;
      var in2=document.getElementById('in2').value;
        var in4=document.getElementById('in4').value;
      var in3=(in1*in2*in4*30)/1000;
      document.getElementById('in3').value=in3;
   }
    function getText39(){
      var in1=document.getElementById('in1').value;
      var in2=document.getElementById('in2').value;
        var in4=document.getElementById('in4').value;
      var in39=((in1*in2*in4*30)/1000)*7.50;
      document.getElementById('in39').value=in39;
   }
     function getText89(){
      var in1=document.getElementById('in1').value;
      var in4=document.getElementById('in4').value;
        var comboB=document.getElementById('comboB').value;
      var in89=in1*in4;
      document.getElementById('in89').value=in89;
   }

i want the result in var in39,var in89,var in3 is upto two decimal place plz help me i realy need this

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
268 views
Welcome To Ask or Share your Answers For Others

1 Answer

Take a look at toFixed(digits).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...