This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating that field has a number

 
Lauren Pender
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to validate in javascript that the text entered in a field is a number.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lauren
use this test
if (isNaN(document.formName.fieldName.value))
if it returns true then the value in the field is not a number.
hope that helps
Dave
[This message has been edited by Dave Vick (edited June 19, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic