var stmp_a = "";
function strTrans_a(strT)
{
if(strT.value==stmp_a) return;
var ms = strT.value.replace(/[^\d\.]/g,"").replace(/(\.\d{3}).+$/,"$1");//验证用户的输入
var txt = ms.split("."); //分割成数组
while(/\d{4}(,|$)/.test(txt[0]))
txt[0] = txt[0].replace(/(\d)(\d{3}(,|$))/,"$1,$2"); //科学计数法表示形式
strT.value = stmp_a = txt[0]+(txt.length>1?"."+txt[1]:"");
}
这个代码是显示 数字的代码
但他有个功能就是整数以前的数,每隔三个数就会出现一个 逗号,我想不让他显示逗号
应该改哪里啊!谢谢
function strTrans_a(strT)
{
if(strT.value==stmp_a) return;
var ms = strT.value.replace(/[^\d\.]/g,"").replace(/(\.\d{3}).+$/,"$1");//验证用户的输入
var txt = ms.split("."); //分割成数组
while(/\d{4}(,|$)/.test(txt[0]))
txt[0] = txt[0].replace(/(\d)(\d{3}(,|$))/,"$1,$2"); //科学计数法表示形式
strT.value = stmp_a = txt[0]+(txt.length>1?"."+txt[1]:"");
}
这个代码是显示 数字的代码
但他有个功能就是整数以前的数,每隔三个数就会出现一个 逗号,我想不让他显示逗号
应该改哪里啊!谢谢
解决方案 »
- 怎样获取新浪微博首页上的热门话题
- 这是什么语法错误~~~~~
- 怎么用js判断ie的版本
- 创建什么object能获得Opera 9.02中显示的文字和URL??
- 用免费jatoolsprinter免费版的打印iframe,没有任何反应,急,在线等!
- 关于<s:select></s:select>的获取text的问题
- 屏蔽Alt 和 Ctrl 键
- 急于解决的问题关于javascript在不同的帧中传参的 问题(500高分回报!·)
- 为什么我的浏览器不能回复;确切的说,不能往csdn回复的地方写内容,能往上粘贴,不能直接写???????
- 有没有办法用纯Javascript取得<form>里面用post方法post过来的数据?100分在线等候!!!绝对给分!!!!!
- nokia wrt 可不可以使用分栏?
- IE浏览器不报javascript的错误
function strTrans_a(strT)
{
if(strT.value==stmp_a) return;
var ms = strT.value.replace(/[^\d\.]/g,"").replace(/(\.\d{3}).+$/,"$1");//验证用户的输入
var txt = ms.split("."); //分割成数组
while(/\d{4}(,|$)/.test(txt[0]))
txt[0] = txt[0].replace(/(\d)(\d{3}(,|$))/,"$1$2"); // replace中把逗号去掉就行了。
strT.value = stmp_a = txt[0]+(txt.length>1?"."+txt[1]:"");
}
function strTrans_a(strT)
{
if(strT.value==stmp_a) return;
var ms = strT.value.replace(/[^\d\.]/g,"").replace(/(\.\d{3}).+$/,"$1");//验证用户的输入
strT.value = stmp_a = ms;
}