如何在javascript中打印货币格式? [英] how do i print currency format in javascript
本文介绍了如何在javascript中打印货币格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些价格值显示在我的网页。
我正在写一个函数,它采用浮动价格并返回带有货币代码的格式化货币val。 。
像fnPrice(1001.01)应该打印$ 1,000.01
解决方案
你必须亲手做这个,JS里面没有任何内容。举个例子看看这个帖子:如何格式化数字作为在JavaScript的钱?
i have some price values to display in my page.
i am writing a function which takes the float price and returns the formatted currency val with currency code too..
like fnPrice(1001.01) should print $ 1,000.01
解决方案
You've got to do this by hand, there is nothing builtin into JS. For an example look at this post here: How can I format numbers as money in JavaScript?
这篇关于如何在javascript中打印货币格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文