View Single Post
Old 01-17-2013, 12:46 AM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Good one, RndMe.

You could also do it a bit more restrictive, if that mattered:
Code:
<style type="text/css">
.hideAll .hide {
    display: none;
}
</style>
...
<div id="holder">
    <div class="hide">...</div>
    <div class="hide">...</div>
    <div class="hide">...</div>
</div>

<a href="#" onclick="document.getElementById('holder').className='hideAll';return false;">Hide all</a>
<a href="#" onclick="document.getElementById('holder').className='';return false;">Show all</a>
You might do it this way if you had multiple "holder" divs where you wanted this kind of control and/or if your <body> needed to be able to change class names for other reasons.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote