floatDecimal.html
This is my HTML page.
Javascript rounds to two decimal places
function count(){
//alert( "count");
var size=~~(document.getElementById("size").value);
var value=0;
for(var i=0;i var val=1*(document.getElementById("afterAdjScor" i).value);
if(null!=val){
value =Math.round((1*(value val) )*100)/100;
}
}
if(isNaN(value)){
value="The input must be a numeric type";
}
document.getElementById( "total").value=value;
}
Description:~~XX: String to int
1*XX: String to float
Math.round((1*(value val))*100)/100: Rounding
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn