.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

JavaScript Number only

Posted By:Sasi Prabhu       Posted Date: July 08, 2011    Points: 40    Category:    URL: http://www.dotnetspark.com  

Javascript to allow Numbers only into Textbox
 


It is done based on the ASCII Code.

To get the ASCII

Refer : ASCII Code List


JavaScript :

function Numbers(events)
{
var ASCIIKeyValue=events.which ? events.which : event.keyCode;
if(ASCIIKeyValue>47 && ASCIIKeyValue<58)
{return true;}
else
{return false;}
}


Page.ASPX





Happy Coding..



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend