For entering number only in textbox

Susanthampy
Posted by Susanthampy under JavaScript category on | Points: 40 | Views : 2300
Javascript:

f
unction numbersonly(e){

var unicode=e.charCode? e.charCode : e.keyCode

if (unicode!=8 && unicode!=46 && unicode!=9){

if (unicode<48||unicode>57)


return false

}


Call this function (numberonly(e)) in textbox's onkeypress event,

<asp:TextBox ID="txtPostalCode" class="contentTblTxtBox" onkeypress="return numbersonly(event);" MaxLength="100" runat="server"></asp:TextBox>

Comments or Responses

Posted by: Pervej on: 11/17/2011 Level:Starter | Status: [Member] | Points: 10

Login to post response