spicymango
Programmer
I need to put a validation code that allow only Letter, Numbers abd spaces. I have the following code that allows only Letter and numbers. but not spaces, how can I make it so it allow spaces as well?
Thanks
Thanks
Code:
<script type="text/javascript">
function alphanumeric(alphane)
{
var numaric = alphane;
for(var j=0; j<numaric.length; j++)
{
var alphaa = numaric.charAt(j);
var hh = alphaa.charCodeAt(0);
if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
{
}
else {
alert("Your Alpha Numeric Test Failed");
return false;
}
}
alert("Your Alpha Numeric Test Passed");
return true;
}
</script>