网页中的货币号格式样式

时间:2017-10-13 07:10:41

标签: javascript html css

我想显示我的票价详情如下。

Faredetails
-------------------
Price            : 1000
VAT              :   20(+)
GST              :   15(+)
Discount         :  100(-)
                ---------------
Total            : 1065

html代码:

<div  class="div-active faredet">
                <h3 style="text-align:center;border-bottom: 1px solid #ccc;">Fare Details</h3>
                <table>
                    <tr>
                        <td>Fare&nbsp;&nbsp;</td>
                        <td>&#x20B9;1,000.00</td>
                    </tr>
                    <tr>
                        <td>Discuount&nbsp;&nbsp;</td>
                        <td>&#8377;10.00<span style="color:red;">&nbsp;(-)</span></td>
                    </tr>
                    <tr style="border-bottom: 1px solid #ccc;"></tr>
                    <tr>
                        <td>Net Payable&nbsp;&nbsp;</td>
                        <td>&#8377;900.00</td>
                    </tr>
                </table>

            </div> 

所有这些值都将动态出现。所以任何人都可以让我如何设计这些价值观。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我们可以使用accounting.js库。

<script src="path/to/accounting.js"></script>

<script type="text/javascript">
    // Library ready to use:
    accounting.formatMoney(5318008);
</script>

参阅:http://openexchangerates.github.io/accounting.js