I am trying to do a simple validation for a text box(House_Sqft) to ensure the user enters in only numbers. The following code I have works if the user enters all letters (ersqgadsfg) but if the user types in a combination of letters and numbers (324324nn) it will accpet it. Any ideas?
var str_in = parseFloat(document.forms[0].House_Sqft.value)
if (isNaN(str_in)) {
alert("You must enter in a number for the house's approximate square feet"
document.forms[0].House_Sqft.value = "";
document.forms[0].House_Sqft.focus();
return false;
}
var str_in = parseFloat(document.forms[0].House_Sqft.value)
if (isNaN(str_in)) {
alert("You must enter in a number for the house's approximate square feet"
document.forms[0].House_Sqft.value = "";
document.forms[0].House_Sqft.focus();
return false;
}