久久久久久久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:格式化數字的更簡單方法?

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

            <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:格式化數字的更簡單方法?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

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

                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"格式化程序中添加逗號,您可以看到priceChg"格式化程序中有一個黑客,我嘗試將 +/- 符號移到'$' 符號.

                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/

                從上面的鏈接:

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

                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.

                這篇關于Javascript:格式化數字的更簡單方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                Detect FLASH plugin crashes(檢測 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>
                        • 主站蜘蛛池模板: 国产成人免费视频网站视频社区 | va精品| 男人午夜视频 | 国产精品久久久久久久久久久久冷 | 欧美一区二区 | 一级黄a视频 | 女人av| 亚洲国产免费 | 日韩在线一区二区 | 国产成人99 | 亚洲欧美日韩中文在线 | 波多野结衣一区二区三区在线观看 | 在线观看免费观看在线91 | 992人人草| 亚洲免费视频播放 | 殴美成人在线视频 | 亚洲在线免费观看 | 欧美精品一区二区在线观看 | 国产精品国产三级国产aⅴ入口 | 丁香五月网久久综合 | 福利一区在线观看 | 日韩在线精品 | 伊人一区| 成人小视频在线观看 | 午夜影院视频在线观看 | 日本淫视频| 一区二区在线 | 国产亚洲精品综合一区 | 狠狠躁18三区二区一区 | 欧美不卡一区二区 | 成人免费视屏 | 成人乱人乱一区二区三区软件 | 黄a网站 | 99热在线播放 | 欧美一区免费 | 成人一区二区三区在线 | 国产成人免费网站 | 在线观看亚洲一区二区 | 亚洲人成免费 | 国产精品久久久久久久久大全 | 一区二区三区中文字幕 |