久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <small id='hzRZb'></small><noframes id='hzRZb'>

    • <bdo id='hzRZb'></bdo><ul id='hzRZb'></ul>
    <legend id='hzRZb'><style id='hzRZb'><dir id='hzRZb'><q id='hzRZb'></q></dir></style></legend>

      <tfoot id='hzRZb'></tfoot>
      <i id='hzRZb'><tr id='hzRZb'><dt id='hzRZb'><q id='hzRZb'><span id='hzRZb'><b id='hzRZb'><form id='hzRZb'><ins id='hzRZb'></ins><ul id='hzRZb'></ul><sub id='hzRZb'></sub></form><legend id='hzRZb'></legend><bdo id='hzRZb'><pre id='hzRZb'><center id='hzRZb'></center></pre></bdo></b><th id='hzRZb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hzRZb'><tfoot id='hzRZb'></tfoot><dl id='hzRZb'><fieldset id='hzRZb'></fieldset></dl></div>

    1. Javascript:格式化數(shù)字的更簡(jiǎn)單方法?

      Javascript: Easier way to format numbers?(Javascript:格式化數(shù)字的更簡(jiǎn)單方法?)

            <legend id='60gpt'><style id='60gpt'><dir id='60gpt'><q id='60gpt'></q></dir></style></legend>

            <small id='60gpt'></small><noframes id='60gpt'>

              <bdo id='60gpt'></bdo><ul id='60gpt'></ul>
                <tbody id='60gpt'></tbody>
              <tfoot id='60gpt'></tfoot>

            • <i id='60gpt'><tr id='60gpt'><dt id='60gpt'><q id='60gpt'><span id='60gpt'><b id='60gpt'><form id='60gpt'><ins id='60gpt'></ins><ul id='60gpt'></ul><sub id='60gpt'></sub></form><legend id='60gpt'></legend><bdo id='60gpt'><pre id='60gpt'><center id='60gpt'></center></pre></bdo></b><th id='60gpt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='60gpt'><tfoot id='60gpt'></tfoot><dl id='60gpt'><fieldset id='60gpt'></fieldset></dl></div>
                本文介紹了Javascript:格式化數(shù)字的更簡(jiǎn)單方法?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時(shí)送ChatGPT賬號(hào)..

                我正在嘗試格式化頁面上的各種數(shù)字.這些數(shù)字代表價(jià)格、價(jià)格變化或百分比.我知道 Javascript 具有限制小數(shù)位數(shù)的功能,但是是否支持其他類型的格式,例如用逗號(hào)對(duì)數(shù)字進(jìn)行分組,控制是否顯示 +/- 等?到目前為止,這是我所擁有的:

                I'm trying to format various numbers on my page. These numbers either represent a price, a change in price, or a percentage. I know Javascript has functions to limit the number of decimal places, but is there any support for other types of formatting, such as grouping numbers with commas, controlling whether or not the +/- is shown, etc? Here's what I have so far:

                var FORMATTER = {
                    price       : function(value) { return '$' + value.toFixed(2); },
                    pricePer    : function(value) { return (value * 100).toFixed(2) + '%'; },
                    priceChg    : function(value) { return (value >= 0 ? '+' : '-') + '$' + Math.abs(value).toFixed(2); }
                };
                

                它工作正常,但它想在price"格式化程序中添加逗號(hào),您可以看到priceChg"格式化程序中有一個(gè)黑客,我嘗試將 +/- 符號(hào)移到'$' 符號(hào).

                It works OK, but it'd like to add commas to the 'price' formatter, and you can see that there's a hack in the 'priceChg' formatter where I try to move the +/- sign in front of the '$' sign.

                基本上,我希望有一些庫可以模擬 Java 的 DecimalFormat 類.

                Basically, I'm hoping there is some library out there (jQuery is OK) that emulates Java's DecimalFormat class.

                推薦答案

                這里有NUMBERFORMATTER jQuery插件,詳情如下:

                There's the NUMBERFORMATTER jQuery plugin, details below:

                https://code.google.com/p/jquery-numberformatter/

                從上面的鏈接:

                這個(gè)插件是一個(gè) NumberFormatter插入.數(shù)字格式可能與任何合作過的人都熟悉服務(wù)器端代碼,如 Java 或 PHP 和誰合作過國(guó)際化.

                This plugin is a NumberFormatter plugin. Number formatting is likely familiar to anyone who's worked with server-side code like Java or PHP and who has worked with internationalization.

                將鏈接替換為更直接的鏈接.

                Replaced the link with a more direct one.

                這篇關(guān)于Javascript:格式化數(shù)字的更簡(jiǎn)單方法?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個(gè)接一個(gè)地依次運(yùn)行 Gulp 任務(wù))
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時(shí) Visual Studio 2015 崩潰)
                Detect FLASH plugin crashes(檢測(cè) FLASH 插件崩潰)

                <small id='Ws7NZ'></small><noframes id='Ws7NZ'>

                • <bdo id='Ws7NZ'></bdo><ul id='Ws7NZ'></ul>
                  <tfoot id='Ws7NZ'></tfoot>

                        <i id='Ws7NZ'><tr id='Ws7NZ'><dt id='Ws7NZ'><q id='Ws7NZ'><span id='Ws7NZ'><b id='Ws7NZ'><form id='Ws7NZ'><ins id='Ws7NZ'></ins><ul id='Ws7NZ'></ul><sub id='Ws7NZ'></sub></form><legend id='Ws7NZ'></legend><bdo id='Ws7NZ'><pre id='Ws7NZ'><center id='Ws7NZ'></center></pre></bdo></b><th id='Ws7NZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ws7NZ'><tfoot id='Ws7NZ'></tfoot><dl id='Ws7NZ'><fieldset id='Ws7NZ'></fieldset></dl></div>
                          <legend id='Ws7NZ'><style id='Ws7NZ'><dir id='Ws7NZ'><q id='Ws7NZ'></q></dir></style></legend>

                            <tbody id='Ws7NZ'></tbody>
                        • 主站蜘蛛池模板: 国产美女毛片 | 91亚洲国产成人精品性色 | 伊人成人在线 | 日韩av免费看 | 黄色在线免费看 | 日日夜夜艹 | 午夜影院在线观看 | 狠狠干在线 | 日韩中文字幕在线视频 | 激情高潮到大叫狂喷水 | 91亚洲视频 | 日韩欧美国产高清91 | 成人黄色免费视频 | 日韩欧美在线视频观看 | 国产极品国产极品 | 色中色av | 国产成人一区二区三区 | 日日夜夜综合 | 一区二区三区在线观看免费 | 一级黄色片在线观看 | 久草免费在线观看视频 | 国产中文一区 | 伊人久久亚洲 | 欧美成人精品欧美一级私黄 | 天天色网站| 国产黄色免费看 | 日韩在线专区 | 黄色小视频在线观看免费 | 韩国三级av| 欧美综合网 | 黄色片免费观看 | 国产精品欧美一区二区 | 99小视频| 国产三级精品视频 | 国产区在线| 国产三级午夜理伦三级 | 日韩欧美国产综合 | 国产一区二区在线视频 | 日本黄a三级三级三级 | 一区免费视频 | www.天天操|