Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow Numbers Only Field

R5 - Web Applications

Allow Numbers Only Field

by  NiteLink  Posted    (Edited  )
The following is placed in the onChange:

Code:
var f = document.forms[0]

var v = f.GPNo.value
for ( i=0; i<v.length; i++) {
if ( ( v.charCodeAt(i)<48 || v.charCodeAt(i)>57 ) && v.charCodeAt(i) !== 44 ) {
alert ( "Gate Pass must be numeric." )
f.GPNo.value = "";
f.GPNo.focus()
return false
}
}
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top