[thelist] Javascript conundrum
Warden, Matt
mwarden at odyssey-design.com
Thu Jul 5 07:30:31 CDT 2001
--
mattwarden
mattwarden.com
----- Original Message -----
From: "kristina" <kristina at kfx-design.co.uk>
To: "The List" <thelist at lists.evolt.org>
Sent: Thursday, July 05, 2001 8:11 AM
Subject: [thelist] Javascript conundrum
...
> i can get both things to work seperately but not together
Well that makes sense...
> function validForm(theForm)
> file://this gets ticked if the user doesn't have an email
address
> if ((!theForm.noemailaddress.checked) && (theForm.email1.value
== ""))
> {
> alert("Please enter your email address or check the NO email
box");
> theForm.email1.focus();
> return (false);
> }
>
> return (true);
Once javascript comes across a return statement, it returns and nothing else
is executed. So, if I have:
function foo(bar)
{
return true;
alert("hiya, kristina.");
}
You shouldn't get an alert.
May I suggest you store the true/false in a variable rather then using a
return statement?
hth,
--
mattwarden
mattwarden.com
More information about the thelist
mailing list