是不是 javascript 的漏洞?怎么解释呀? 这是浮点型数值精度问题,不是bug 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用toFixed(),不过要ie5.5+支持.<script>alert((133.32-3.55).toFixed(2));</script>或是用VBscript<script language="VBScript">alert(133.32-3.55)</script> //不同版本增加方法,如果版本底,没有toFixed方法则增加数字的toFixed方法try { (1).toFixed(1);}catch(e) { Number.prototype.toFixed = function(dot) { with(Math){ var m=pow(10,Number(dot)) var s = (round(this*m)/m).toString(); } if(s.indexOf('.') < 0) s += "."; s += "00000000000000000000000000"; return s.substr(0,s.indexOf('.')+dot+1); }}alert((133.32-3.55).toFixed(2)); javascript代码的问题 ExtJs一点小问题 如何修改样式 dwr.engine为空或不是对象 高手们我在线等 发现:position:absolute可有效提高页面运行速度? javascript检测表单中含有qq.com 数据库相对路径问题 动态获取座标问题 js的 substring方法是怎么实现的? js读出表单全选ID怎么传到后台 VBSCRIPT数组问题? 请教两个问题
<script>
alert((133.32-3.55).toFixed(2));
</script>或是用VBscript<script language="VBScript">
alert(133.32-3.55)
</script>
try {
(1).toFixed(1);
}
catch(e) {
Number.prototype.toFixed = function(dot) {
with(Math){
var m=pow(10,Number(dot))
var s = (round(this*m)/m).toString();
}
if(s.indexOf('.') < 0)
s += ".";
s += "00000000000000000000000000";
return s.substr(0,s.indexOf('.')+dot+1);
}
}alert((133.32-3.55).toFixed(2));