Number range using JavaScript
I need a code example of a Javascript function that will test for a number range that can include whole numbers and decimals. I am not a Javascript programmer but I do have a function that was written for me that is part of this validation that I am including as an example. This validation is made against several functions. Here is the example that has nothing to do with a number range:
function validInt(formField,fieldLabel,required)
{
var result = true;
if (required && !validRequired(formField,fieldLabel))
result = false;
if (result)
{
var num = parseInt(formField.value);
if (isNaN(num))
{
alert('Please enter a number for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}
}
return result;
}
|