javascript如何取小数点后四位数?function getResult() { var sum; sum=parseInt(document.form1.m9.value)*7.05; document.form1.m10.value=Round(sum,2); }

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/18 17:45:34
javascript如何取小数点后四位数?function getResult() { var sum; sum=parseInt(document.form1.m9.value)*7.05; document.form1.m10.value=Round(sum,2); }
xՑ1O1ٻ31 zpׂɅh‚8D'VM7述5@K|ߓ>+NB`"{N'lpx}ɮh:髶\4u"*$M-̍DF(2r@ơEj$0-R/VbI@=emC'ޜPWbj%]o`Z_]{;Jض[?}.ޘH?.[YZDHNC,NK-u?{3%ĬYݧFHG7h@ kJF0AlJXf!̙2s 0LKuP?l

javascript如何取小数点后四位数?function getResult() { var sum; sum=parseInt(document.form1.m9.value)*7.05; document.form1.m10.value=Round(sum,2); }
javascript如何取小数点后四位数?
function getResult()
{
var sum;
sum=parseInt(document.form1.m9.value)*7.05;
document.form1.m10.value=Round(sum,2);
}

javascript如何取小数点后四位数?function getResult() { var sum; sum=parseInt(document.form1.m9.value)*7.05; document.form1.m10.value=Round(sum,2); }
//四舍五入到num后面的n位
function getResult(num,n){
return Math.round(num*Math.pow(10,n))/Math.pow(10,n);
}
//截取n位
function getresult(num,n){
return num.toString().replace(new RegExp("^(\\-?\\d*\\.\\d{0,"+n+"})(\\d*)$"),"$1")+0;
}