将文本框中的数据格式化为$ ###,###,###,## 0.00 [英] Formatting Data in Textbox to $###,###,###,##0.00

查看:289
本文介绍了将文本框中的数据格式化为$ ###,###,###,## 0.00的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,我一直想要$ ###,###,###,## 0.00格式的数据(例如$ 25.00).现在输入一些数据,我想得到相同的格式.例如,如果我输入25,则应转换为$ 25.00,如果我输入'as23afs'(字符),则应转换为$ 0.00.我该怎么做?请提出解决方案.如果我可以使用正则表达式,该怎么办?

I have a textbox where I always want data in $###,###,###,##0.00 format (like $25.00 ). Now on typing some data i want to get the same format . For ex if i type 25 it should convert to $25.00 and if i input 'as23afs' (characters) it should convert to $0.00 . How can i do it? Please suggest a solution. If I can make use of Regular expressions how can i do it?

推荐答案

看看这些插件:

  1. http://digitalbush.com/projects/masked-input-plugin/
  2. http://www.meiocodigo.com/projects/meiomask/
  3. http://www.decorplanit.com/plugin/
  1. http://digitalbush.com/projects/masked-input-plugin/
  2. http://www.meiocodigo.com/projects/meiomask/
  3. http://www.decorplanit.com/plugin/

这篇关于将文本框中的数据格式化为$ ###,###,###,## 0.00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆