<script>
function set(id,va)
{
aa=Math.round(id*Math.pow(10,va))/Math.pow(10,va);
return aa;
}
alert(set(111.23333223,2));
</script>
function set(id,va)
{
aa=Math.round(id*Math.pow(10,va))/Math.pow(10,va);
return aa;
}
alert(set(111.23333223,2));
</script>
try {
(1).toFixed(1); // ie5不支持此方法
}
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 += "000000000000";
return s.substr(0,s.indexOf('.')+dot+1)+"a";
}
}a = (3.1415).toFixed(2); //这样就没有版本限制了
</script>