i was rounding off the value to .25,.50,.75 and .00 in the javascript. and the code is as below.
function roundOff(obj) {
//alert(document.getElementById("sample").value);
var val=obj.value;
var newValue;
var floorValue = Math.floor(val);
var remainder = val - floorValue;
if (remainder < 0.325) {
if (remainder < 0.125) {
newValue = floorValue;
} else {
newValue = floorValue + 0.25;
}
} else {
if (remainder < 0.625) {
newValue = floorValue + 0.5;
} else if (remainder < 0.875) {
newValue = floorValue + 0.75;
} else {
newValue = floorValue + 1;
}
}
alert(floorValue);
alert(newValue);
document.getElementById("sample").value=newValue;
//return obj;
}
but am not able to put the value back to the jsp page. if i type 5.5, only 5 is displayed in the jsp. but if i put alert and check the value of floorvalue then it is 5.5. but if i put it to the textbox in jsp it is giving only 5. why is it so???