Hi,
I am not sure how well my experience in doing something similar applies, but
I will give it a go
I have several paragraphs which open/close when a button is clicked
The code looks like this
<body onload="changeImages('3')"> (The parameter is how many <div>s
you have with id= "div1", "div2", etc,)
<div id="div1Header">
<p>
<a onclick="changeVisibility('1');return false;" href="#1">
<img src="images/blank.gif" name="image1" alt="Up/Down image"></a>
Trevor
</p>
</div>
<div id="div1">
<p>
SOME TEXT IN HERE WHICH IS INITIALLY HIDDEN
</p>
</div>
These are the functions
function changeImages(NoImgs)
{
for (i = 1; i <= NoImgs; i++)
{ document.getElementById("div" + i).style.display = "none";
document.images["image" + i].src = "images/plus.gif"; }
}
function changeVisibility(divID)
{
tempSrc = (document.images["image" + divID].src);
if ((tempSrc.substring(tempSrc.lastIndexOf('/')+1, tempSrc.length-4)) ==
"minus")
{ document.images["image" + divID].src = "images/plus.gif" ;
document.getElementById("div" + divID).style.display = "none"; }
else
{ document.images["image" + divID].src = "images/minus.gif" ;
document.getElementById("div" + divID).style.display = "block"; }
}
You need 3 gifs, blank.gif, plus.gif and minus.gif in the images
directory(say)
You can create blank.gif yourself; the other two I think I found somewhere
on the PC - search in C: drive and you should find them. A size of 15*15
works for me.
If you want to look at the effect, see About Us on
http://tandcl.homemail.com.au/
--
Cheers,
Trevor L.
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html