onclick, open all divs, onclick again, close all divs with a text link
Posted on 2004-11-26
I have a page with 12 divs that when clicked on, they will open to show hidden data.
I need to have a text link at the top of the page that will expand or open all 12 divs, and, if you click this text link again, it will close all 12 divs.
Originally, I had a checkbox do this. Here is the script for the checkbox:
var cEx = (theBox.checked==true)?"O":"C";
In, the previous script, the "O" is for the open state of the 12 divs, and the "C" is for the closed state of the 12 divs.
And, here is the checkbox code:
<input type="checkbox" onclick="expand(this)">
Any help with this will be greatly appreciated.