Ivoman
09-26-2007, 07:17 AM
I need a script (showhide.js) that can make the following work:
<html>
<head>
<title>Show/Hide - Expand All/Shrink All</title>
<script type="text/javascript" src="showhide.js" ></script>
</head>
<body>
<p align="center"><a href="javascript:expand_all(27);">Expand All</a> / <a href="javascript:shrink_all(27);">Shrink All</a></p>
<p><a href="javascript:display(cat_1);">Cat_1</a></p>
<div id="cat_1">Show content of Cat_1</div>
<p><a href="javascript:display(cat_2);">Cat_2</a></p>
<div id="cat_2">Show content of Cat_2</div>
<p><a href="javascript:display(cat_...);">Cat_...</a></p>
<div id="cat_...">Show content of Cat_...</div>
<p><a href="javascript:display(cat_27);">Cat_27</a></p>
<div id="cat_27">Show content of Cat_27</div>
</body>
</html>
Notice the '27' and the cat_#
These are generated with php. At this moment there are 27 categories, but they can increase to 28, 29, etc. whenever a category is added.
The javascript:display(cat_1); should show its div when clicked and hide it when clicked again.
The javascript:expand_all(27); should expand cat_1, cat_2, ... up to cat_27.
The javascript:shrink_all(27); should shrink cat_1, cat_2, ... up to cat_27.
The only thing missing is the script (showhide.js) itself... :)
<html>
<head>
<title>Show/Hide - Expand All/Shrink All</title>
<script type="text/javascript" src="showhide.js" ></script>
</head>
<body>
<p align="center"><a href="javascript:expand_all(27);">Expand All</a> / <a href="javascript:shrink_all(27);">Shrink All</a></p>
<p><a href="javascript:display(cat_1);">Cat_1</a></p>
<div id="cat_1">Show content of Cat_1</div>
<p><a href="javascript:display(cat_2);">Cat_2</a></p>
<div id="cat_2">Show content of Cat_2</div>
<p><a href="javascript:display(cat_...);">Cat_...</a></p>
<div id="cat_...">Show content of Cat_...</div>
<p><a href="javascript:display(cat_27);">Cat_27</a></p>
<div id="cat_27">Show content of Cat_27</div>
</body>
</html>
Notice the '27' and the cat_#
These are generated with php. At this moment there are 27 categories, but they can increase to 28, 29, etc. whenever a category is added.
The javascript:display(cat_1); should show its div when clicked and hide it when clicked again.
The javascript:expand_all(27); should expand cat_1, cat_2, ... up to cat_27.
The javascript:shrink_all(27); should shrink cat_1, cat_2, ... up to cat_27.
The only thing missing is the script (showhide.js) itself... :)