Hi, I am using this script to add up the contents of a form, It works great except it won't accept a decimals input.
That is because a friend disabled all other characters, what I need to do though is enable the decimal key so it will allow you to enter a decimal,
thanks in advance
That is because a friend disabled all other characters, what I need to do though is enable the decimal key so it will allow you to enter a decimal,
thanks in advance
Code:
function add(){
var form = window.frmMain;
form.Total.value = parseFloat(cBlankToZero(form.cents20.value)) + parseFloat(cBlankToZero(form.cents50.value)) + parseFloat(cBlankToZero(form.dollar1.value)) + parseFloat(cBlankToZero(form.dollars2.value)) + parseFloat(cBlankToZero(form.dollars5.value)) + parseFloat(cBlankToZero(form.dollars10.value)) + parseFloat(cBlankToZero(form.dollars20.value)) + parseFloat(cBlankToZero(form.dollars50.value)) + parseFloat(cBlankToZero(form.dollars100.value));
}
function numericOnly(){
if (window.event.keyCode < 48 || window.event.keyCode > 57){
window.event.returnValue = false;
}
}
function cBlankToZero(x){
if (x=="")
return 0;
else
return x;
}