<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[a-zA-Z][a-zA-Z0-9 ]*$/; //this is the pattern of regular expersion
if(regex1.test(a)== false){
alert('Please enter aplphanumeric without white Space ');
MyTextBox.focus();
return false;
}
else {
alert('Accepted ');
}
}
</script>
**********************
<html>
<body>
<INPUT name="MyTextBox" type="text" id="MyTextBox">
<INPUT onClick="Validation();" id=Button1 type=button value="Test
" name=btnTest>
</body>
</html>
[ add comment ] ( 1 view ) | permalink |




( 3.1 / 16 )
Calendar



