sandeepinat
asked on
Validation in Javascript for Alphabets only
Validation in Javascript for Alphabets only
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this is what i ma doing but no alert is showing to me.
<script type="text/javascript">
regExpression = /^[A-Za-z]*$/ ;
function validate(){
if(!regExpression.test(document.form.phone.value)){
alert(getMessage("Invalid Text"));
document.formname.TextBox1.focus();
document.formname.TextBox1.select();
return false;
}
}
</script>
<form name="form" method="post" action="phone.php" onSubmit="return validate();">
Phone number: <input type="text" name="phone"><input type="button" value="submit" />
</form>
{
var c=event.keyCode;
event.keyCode=(!( (c>=65 && c<=90)||(c>=97 && c<=122)|| (c==32)))?0:event.keyCode;
}