久久久久久久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>
                        • 主站蜘蛛池模板: 狠狠操狠狠干 | 香蕉婷婷 | 欧美精品一区二区在线观看 | 亚洲精品在线视频 | 久久成人免费 | aacc678成免费人电影网站 | 91精品国产综合久久久动漫日韩 | 欧美性久久久 | 欧美精品中文字幕久久二区 | 日本中文字幕一区 | 国产综合第一页 | 日韩三级在线 | 99久久精品一区二区毛片吞精 | 一区欧美 | 一级毛片免费 | 久久99精品久久久久久国产越南 | 在线观看国产视频 | 在线播放国产一区二区三区 | av电影手机在线看 | 在线精品亚洲欧美日韩国产 | 北条麻妃av一区二区三区 | 黄色亚洲网站 | 欧美成人精品一区二区男人看 | 免费一级黄色录像 | 久久综合久久久 | 欧美在线国产精品 | 超碰在线97国产 | 精品一区二区三区四区 | 偷拍自拍第一页 | 久久综合激情 | 欧美在线一区二区三区 | 99久久精品免费看国产四区 | 欧美日韩国产在线观看 | 波多野结衣一二三区 | 亚洲精品一区二三区不卡 | 三极网站| 国产成人精品久久久 | 久国久产久精永久网页 | 久久99久久 | 国产一区亚洲 | 欧美精品久久 |