浪跡天涯
          web報表設計器....
          posts - 61,comments - 71,trackbacks - 0

          ?

          < script?language = " JScript " >
          Number.prototype.toFixed
          = function(num)
          ???
          {
          ???
          // 重新構造toFixed方法,IE5.0+
          ???with(Math) this .NO = round( this .valueOf() * pow( 10 ,num)) / pow( 10 ,num);
          ???
          return ?String( / \. / g.exec( this .NO) ? this .NO: this .NO + " . " + String(Math.pow( 10 ,num)).substr( 1 ,num));
          ???}

          alert((
          12.9299 ).toFixed( 2 ));
          alert((
          12.9999 ).toFixed( 2 ));
          </ script > ??
          posted on 2008-04-15 13:05 JJCEA 閱讀(2754) 評論(1)  編輯  收藏 所屬分類: JS日記

          FeedBack:
          # re: js中控制小數點的位數
          2013-10-12 09:33 | d
          d  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 娄底市| 康保县| 海林市| 奎屯市| 昆山市| 扎赉特旗| 武安市| 邵东县| 龙陵县| 门源| 娱乐| 利津县| 潍坊市| 缙云县| 扎鲁特旗| 汝南县| 鲁山县| 建宁县| 突泉县| 米林县| 铅山县| 米脂县| 海宁市| 鄂伦春自治旗| 桐城市| 义乌市| 新干县| 孟连| 厦门市| 万山特区| 平顺县| 鹤峰县| 洪雅县| 台中市| 临沭县| 灌阳县| 镇坪县| 承德县| 万全县| 元江| 砚山县|