[thelist] Javascript if...or statement

Chris W. Parker cparker at swatgear.com
Fri Aug 30 11:45:05 CDT 2002


> -----Original Message-----
> From: Cymbala, Greg [mailto:Greg.Cymbala at Den.Galileo.com]
> Sent: Friday, August 30, 2002 9:23 AM
> To: 'thelist at lists.evolt.org'
> Subject: RE: [thelist] Javascript if...or statement
>
>
> You just need to make sure at least one is selected from?
> And it's OK if
> both are selected?  Then try:

to all you javascript people that responded to this post and didn't
suggest to change the || to &&, please read my tip.

you can test this (in case it doesn't make sense) in your language of
choice. i used VBScript.

If(True AND True) Then
	Response.Write("True")
Else
	Response.Write("False")
End If

and so on...

<tip type="logical AND and OR" author="chris parker">
note to all programmers:

when using a conditional statement that must result in true when both
cases are the same you must use a logical AND operator, not OR.

when using a conditional statement that must result in true if only one
case is true you must use a logical OR operator, not AND.

True AND True = True
False AND True = False
True AND False = False
False AND False = False

True OR True = True
True OR False = True
False OR True = True
False OR False = False
</tip>

chris.

p.s. if i'm wrong about those statements please beat me up.



More information about the thelist mailing list