Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Participant
1560 Points
299 Posts
Mar 01, 2012 01:50 PM|LINK
Change your code as below mentioned
1.
function isNumeric(e) { var c = getKeyCode(e); if (c != 8 && (c < 48 || c > 57)) { return false; } return true; } <asp:TextBox ID="txt_numeric" runat="server" MaxLength="2" onkeypress="return isNumeric(this);" Width="50px"></asp:TextBox>
or for checking numeric values simply use below mentioned code in your design
2.
<asp:TextBox ID="txt_numeric" runat="server" MaxLength="2" onkeyup="this.value=this.value.replace(/[^0-9]/,'');" Width="50px"></asp:TextBox>
Hope it helps you!!
jbkumar
Participant
1560 Points
299 Posts
Re: Script is not working in IE
Mar 01, 2012 01:50 PM|LINK
Change your code as below mentioned
1.
function isNumeric(e) {
var c = getKeyCode(e);
if (c != 8 && (c < 48 || c > 57)) {
return false;
}
return true;
}
<asp:TextBox ID="txt_numeric" runat="server" MaxLength="2" onkeypress="return isNumeric(this);" Width="50px"></asp:TextBox>
or for checking numeric values simply use below mentioned code in your design
2.
<asp:TextBox ID="txt_numeric" runat="server" MaxLength="2" onkeyup="this.value=this.value.replace(/[^0-9]/,'');" Width="50px"></asp:TextBox>
Hope it helps you!!
Happy Coding !!!