js添加千分位的实现代码(超简单)
作者:jingxian 时间:2023-08-25 07:43:29
JS 添加千分位,测试可以使用
<script language="javascript" type="text/javascript">
function comdify(n){
var re=/\d{1,3}(?=(\d{3})+$)/g;
var n1=n.replace(/^(\d+)((\.\d+)?)$/,function(s,s1,s2){return s1.replace(re,"$&,")+s2;});
return n1;
}
</script>
<input type="text" value="1212133345.78" onblur="this.value=comdify(this.value)">
标签:js,添加,千分位
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
javascript 文章截取部分无损html显示实现代码
2024-04-19 09:57:11
5个css布局的常见问题及解决方法
2009-11-19 13:21:00
![](https://img.aspxhome.com/file/UploadPic/200911/19/css_layout-83s.png)
python 文件下载之断点续传的实现
2023-07-18 21:57:16
![](https://img.aspxhome.com/file/2023/5/130635_0s.png)
scrapy头部修改的方法详解
2023-09-13 05:58:10
![](https://img.aspxhome.com/file/2023/0/82720_0s.png)
Python3 操作符重载方法示例
2021-03-18 11:38:03
firefox通过XUL实现text-overflow:ellipsis的效果
2008-07-08 19:12:00
python实现简单多人聊天室
2022-08-17 15:04:13
![](https://img.aspxhome.com/file/2023/7/67887_0s.jpg)
numpy下的flatten()函数用法详解
2021-08-19 04:27:54
MySql如何获取相邻数据
2024-01-16 04:36:53
![](https://img.aspxhome.com/file/2023/5/115285_0s.png)
深入解析Go语言编程中的递归使用
2023-10-09 09:24:36
python+mediapipe+opencv实现手部关键点检测功能(手势识别)
2022-04-20 17:26:05
![](https://img.aspxhome.com/file/2023/3/114743_0s.jpg)
编写安全的SQL Server扩展存储过程
2008-11-25 11:16:00
轻松学习jQuery插件EasyUI EasyUI创建RSS Feed阅读器
2024-05-03 15:31:44
![](https://img.aspxhome.com/file/2023/3/129713_0s.jpg)
BootstrapValidator超详细教程(推荐)
2024-04-10 13:53:24
Python全栈之进程和守护进程
2021-11-25 18:05:44
![](https://img.aspxhome.com/file/2023/1/70781_0s.png)
利用Python实现绘制3D爱心的代码分享
2021-03-30 23:25:12
![](https://img.aspxhome.com/file/2023/2/109512_0s.gif)
一个模仿oso的php论坛程序源码(之二)第1/3页
2024-05-02 17:07:10
浅谈Transact-SQL
2024-01-23 20:13:22
django-rest-framework 自定义swagger过程详解
2023-01-01 22:05:34
![](https://img.aspxhome.com/file/2023/4/72214_0s.png)
python开发飞机大战游戏
2022-10-08 05:15:37
![](https://img.aspxhome.com/file/2023/9/121739_0s.jpg)