浪跡天涯
          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 閱讀(2748) 評論(1)  編輯  收藏 所屬分類: JS日記

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

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


          網站導航:
           
          主站蜘蛛池模板: 昌邑市| 海南省| 怀集县| 星子县| 瑞安市| 新田县| 蕲春县| 辰溪县| 增城市| 岑溪市| 龙游县| 公安县| 卢湾区| 河东区| 台中县| 梧州市| 高邑县| 巧家县| 诸城市| 哈密市| 江都市| 双柏县| 饶河县| 河源市| 乌鲁木齐市| 大庆市| 麻城市| 合水县| 金溪县| 洛扎县| 乌苏市| 宝应县| 庆安县| 常山县| 含山县| 左云县| 津市市| 兖州市| 封开县| 富阳市| 乐亭县|