[Javascript] Show and hide multiple div tags

Abyss - Information Info at Abyss.ws
Thu May 11 16:59:11 CDT 2006


Yes I understand that.

I was just wondering (to which i will yahoo a ternary statement in a minute)

why and how does it work with the? and the :

Abyss


----- Original Message ----- 
From: "Triche Osborne" <wdlists at triche-osborne.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, May 12, 2006 7:55 AM
Subject: Re: [Javascript] Show and hide multiple div tags


> Abyss - Information wrote:
>>
>> its the "?" and the ":" that have thrown me into confusion
>>
>
> This is what is known as a ternary if statement.
>
> show.style.display =
>   (!show.style.display || show.style.display=="none")? "block" : "none";
>
> Written in the common if()/else form, it would look like this:
>
> if (!show.style.display || show.style.display=="none") {
>
>     show.style.display = "block";
> } else {
>     show.style.display = "none";
> }
>
> Does this make sense?
>
> Triche
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 





More information about the Javascript mailing list