[thelist] JavaScript Netscape help
Scott Adamson
scott at milcap.com
Fri Nov 16 05:54:25 CST 2001
try onblur instead
----- Original Message -----
From: "Ryan Carmody" <carmodyryan at hotmail.com>
To: <thelist at lists.evolt.org>
Sent: Friday, November 16, 2001 1:52 AM
Subject: [thelist] JavaScript Netscape help
> Hi all,
>
> I have an input box on a popup that I would like to validate the info
> entered into. I would like the validation of the info to take place when
a
> user clicks out of the box. Therefore I'm using onchange, which calls a
> validation function that checks the validity of the info entered. If the
> info entered is ok, great, if not, have an error message popup and set the
> focus back to the input box. It work fine in IE, but not in NS. In NS
when
> the focus goes back on the input box with the invalid info if the user
> doesn't change the info the validation function isn't called again like it
> should and does in IE. It's as if onchange isn't recognized in NS unless
> the info is actually changed. If anyone can help me here it would be much
> appreciated. Below is the function, which is called by onchange, set in
> the input tag. If someone has a better solution than the approach I'm
> taking that would be good also.
>
> function validateInfo() {
> var x = 0;
> var RSSN=/^[0-9]$/;
> for (i = 0; i < document.main.test.value.length; i++) {
> if (document.main.test.value.charAt(i) != "," &&
> document.main.test.value.charAt(i) != "-" &&
> !document.main.test.value.charAt(i).match(RSSN) &&
> document.main.test.value.charAt(i) != " ") {
> x = 1;
> }
> }
> if(x == 1) {
> alert("Please only enter numbers, commas, and dashes (-).");
> document.main.test.focus();
> return(false);
> }
> else {
> return(true);
> }
> }
>
> Thanks,
> Ryan J. Carmody
> carmodyryan at hotmail.com
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
More information about the thelist
mailing list