[Javascript] "display none" to all children

Mike Dougherty mdougherty at pbp.com
Wed May 30 09:00:43 CDT 2007


On 5/30/07, Paul Novitski <paul at juniperwebcraft.com> wrote:
>
>          <div id="sheet">
>              <div class="subsheet" id="subsheet1"></div>
>              <div class="subsheet" id="subsheet2"></div>
>              <div class="subsheet" id="subsheet3"></div>
>          </div>
>

I believe what David Dorward was suggesting was something like this
(guessing)
[CSS]
#sheet.hideSubs div.subsheet { display: none; }

[javascript]
(hide) document.getElementById("sheet").className = "hideSubs";
(show) document.getElementById("sheet).className = "";

* caveat:  for the sake of simplicity, this example assumes #sheet has only
one className - but there may be an existing class on that element, so it's
probably better to have a routine that intelligently manages the addition
and removal of individual classNames from the space-separated list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070530/e0cb1d23/attachment.htm>


More information about the Javascript mailing list