- <script language="javascript">
- /*
- * ForDight(Dight,How):數值格式化函數,Dight要
- * 格式化的 數字,How要保留的小數位數。
- */
- function ForDight(Dight,How)
- {
- Dight = Math.round (Dight*Math.pow(10,How))/Math.pow(10,How);
- return Dight;
- }
- alert(ForDight(12345.67890,2));
- </script>
在http://hitsnail.javaeye.com/blog/437066人的博客上看見的