1. Clear the decimal point to zero:
function returnFloat0 (value) {
value = Math.round(parseFloat(value));
return value;
}
2. Keep one decimal point:
function returnFloat1(value) {
value = Math.round(parseFloat( value) * 10) / 10;
if (value.toString().indexOf(".") < 0) {
value = value.toString() ".0";
}
Return value;
}
3. Keep two decimal points
function returnFloat2(value){
value = Math.round(parseFloat(value) * 100) / 100;
if (value.toString().indexOf( ".") < 0) {
Two decimal points and one decimal point are automatically filled with zeros
Copy code
value = value.toString() ".00";
return value;
}
if(xsd .length>1){
🎜>}