Validate TextBox that accpet only Alphanumeric value with white Space 
This is a simple way to validate a textbox that accept only alphanumric value with space.


<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 )

<<First <Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Next> Last>>