Eliminating decimals

admin

Administrator
Staff member
I have an HTML program that I have written, that has two input fields in it. One of the Input fields allows the user to enter in a Total Quantity. Once they enter data in the two Input fields, the program takes them to a second page.

What I am trying to do, is create a Javascript function that will take out the decimal points if accidently entered. I have tried the isNaN function and it does not do anything for this situation.

Here is what I have so far:

if (isNaN(document.CoreRecvd.totqty.value)) {
window.alert("Total Quantity must be Numeric.");
CoreRecvd.totqty.focus();
return false;
}
return true;
}

Can anyone please tell me how to get rid of decimals if accidently entered?
I would greatly appreciate it!
 
Back
Top