<script type="text/javascript">
//Function to allow only numbers to textbox
function validate(key) {
//getting key code of pressed key
var keycode = (key.which) ? key.which : key.keyCode;
var phn = document.getElementById('txtSortOrder');
//comparing pressed keycodes
if (!(keycode == 8 || keycode == 46) && (keycode < 48 || keycode > 57)) {
return false;
}
else {
return true;
}
}
</script>
<asp:TextBox ID="txtPhn" runat="server"
onkeypress="return validate(event)"></asp:TextBox>
//Function to allow only numbers to textbox
function validate(key) {
//getting key code of pressed key
var keycode = (key.which) ? key.which : key.keyCode;
var phn = document.getElementById('txtSortOrder');
//comparing pressed keycodes
if (!(keycode == 8 || keycode == 46) && (keycode < 48 || keycode > 57)) {
return false;
}
else {
return true;
}
}
</script>
<asp:TextBox ID="txtPhn" runat="server"
onkeypress="return validate(event)"></asp:TextBox>
No comments:
Post a Comment