I've been collecting JavaScript code that allows me to hide/show sections of a
web page. (You can see all of the relevant JavaScript, etc., by selecting View Source for this page.)
I found some code at www.rgagnon.com that uses a pair of "Hide" and "Show" buttons.
The Sample code at
support.internetconnection.net
provides a choice of links which alternately "show" a different snippet of text
in the same place.
I started with the super simple hide/show code from
www.movalog.com.
Then, I Googled for JavaScript code that swapped a pair of images. I found a
simple and easy-to-understand example at
javascript.internet.com.
I merged the two bits of code together into one function, added some variables,
grabbed a couple of GIFs, put it all together, and...
Ta Da!
<a href="#Anchor" onclick="toggle('Block_1', 'Img_1');"
><img src="hide.gif" border=0 name="Img_1">Click Here</a>
<div id="Block_1" style="display:none;">
Text to show or hide
</div>
Important
Whichever solution you choose, be sure to assign each div a unique ID.
<div id="Block_1" style="display:none;">
If you
also include a changing image, assign a unique name parameter to each image. It helps to give the div/img a mnemonic id/name pair.
<img src="hide.gif" name="Img_1">
Otherwise, your clicks may hide/show unexpected sections of the page!
Do a View Source to see what I mean.