Monday, January 2, 2012

How to validate Numeric Text Box using javascrit

<Script Type = "Javascript">
function numbersonly(e)
    {
//alert('hi');
var unicode=e.charCode? e.charCode : e.keyCode;
if (unicode!=8 && unicode!=46 && unicode!=9)
{
if (unicode<48||unicode>57)
return false
}
}


How to access

<asp:TextBox ID="TextBox1" runat="server" onkeypress="return numbersonly(event);"></asp:TextBox>

No comments:

Post a Comment