PDA

View Full Version : focus on number validation


florida
04-15-2003, 08:29 PM
Trying to get focus to work for this number validation. This gets focus to work but corrupts the validation. any suggestions?

var nbr = Number(theform.month.value);
if (isNaN(nbr.value))
{
alert("Not a number.");
theform.month.focus();
}

cheesebagpipe
04-15-2003, 09:04 PM
1) var nbr = Number(theform.month.value);

get field value, cast with Number(), put in variable. OK...


2) if (isNaN(nbr.value))

test .value property of variable nbr? :confused: