CryOnMyShoulder
<script language="javascript"> 
document.write("<h1>JS保留两位小数例子</h1><br>");  
   var a=0.156;  
   document.write("原来的值:"+a+"<br>");  
   document.write("两位小数点:"+a.toFixed(2)+"<br>四位小数点"+a.toFixed(4)+"<br>");  
   document.write("加百分号,两位小数点:"+a.toFixed(2)+"%<br>四位小数点"+a.toFixed(4)+"%");  
</script> 

 

分类:

技术点:

相关文章: