js1.5以上可以利用toFixed(x) ,可指定数字截取小数点后 x位 for example : //round "original" to two decimals var result=original.toFixed(2); //returns 28.45 // round "original" to 1 decimal var result=original.toFixed(1); //returns 28.5…
0和#都是占位符,但在不同的地方,作用不一样0: 比实际数字的位数多,不足的地方用0补上. new DecimalFormat("00.00").format(3.14) //结果:03.14 new DecimalFormat("0.000").format(3.14) //结果: 3.140 new DecimalFormat("00.000").format(3.14) //结果:03.140 比实际数字的位数少:整数部分不改动,小数部分,…
Anyone who has worked with web apps has likely created a masking element at some point, and the great thing about a masking element is that it intercepts user interaction, letting us create a pseudo-modal user interface. The masking element enables u…