Validate TextBox that accept only Numeric value using javascript. 
This code display a textbox that accept only numeric value.

<script type="text/javascript">
function Validation(){
var a=document.getElementById('MyTextBox').value;
var regex1=/^[0-9]*$/;
if(regex1.test(a)== false){
alert('Please enter only Numeric value ');
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
Number!" name=btnTest>

</body>
</html>

[ add comment ]   |  permalink  |   ( 3 / 15 )

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