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

Top 5 Contributors of the Month
Ava Aiden
Imran Ghani
Thomas Shaw

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;}
{return false;}


Happy Coding..


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

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