分类文章

热门文章

javascript 四舍五入到2位小数

Float数据四舍五入到2位小数;

function to2bits(num) { 
if(parseFloat(num) == num) 
return Math.round(num* 100) / 100; 
else 
return 0; 
}

Float数据四舍五入到4位小数;

function to2bits(num) { 
if(parseFloat(num) == num) 
return Math.round(num* 10000) / 10000; 
else 
return 0; 
}

随机文章



分享生活也赚钱,赶快加入吧

Loading…

相关文章:

  1. javascript简单实现随机数
  2. javacript div弹出框
  3. javascript 去除字符串空格
  4. javascript:void(0) 与 href=”#”
  5. javascript压缩工具 jsmin

请给本文打分   
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word