View Single Post
  #4 (permalink)  
Old July 29th, 2003, 02:34 AM
mateenmohd mateenmohd is offline
Friend of Wrox
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts

if non numeric value inter it is give alert message that enter numeric value but it is not focus on it. But it move to next page why ?

document.forms[0].elements[i].focus() not working .

how can stop to move it to next page ?
I am using <input type=submit value=show >


quote:Originally posted by pgtips
 regular expressions are the way to go with this sort of thing, try
if ( /[^0-9]/.test(fn) ) { alert ("Please enter Numeric Value "); ... }
that will check whether the field contains any non-numeric characters, but it won't check for empty field, but this will:
if (!(/^\d+$/.test(fn)) ) { alert ("Please enter Numeric Value ");  }
Do you want to allow decimals, example 12.75?

Reply With Quote