JS加千分符

时间:2014-05-08 14:42:40   收藏:0   阅读:283

<script language="JavaScript">   
n="1279834847944074100465236.33"  
re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g   
n1=n.replace(re,"$1,")   
alert(n+"\r\n"+n1)   
document.write(n+"\r\n"+n1);  
</script>

JS加千分符,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!