Click to See Complete Forum and Search --> : to hide and show specified region in html file


rashmi
07-22-2003, 06:39 AM
hi,
:confused:
I have a html file. It contains some topics below which is its description( similar to help files) along with a image of a closed book.

Now the thing is when ever I click the topic, the description should be visible if it is previously invisible and vice versa.
I have done this using div tag and javascript....

But I want this to be dynamic... the Problem here is if the topic contains 5 line description and if it is hidden an empty space is displayed after that the next topic . I want to remove this space. Like,it should be like this:
topic1
topic2
.
topicn
if I click on topic1 description should come below it and topic 2 should be adjusted with that...


if any one knows plz do help me.............

bye..................
: :p

gil davis
07-22-2003, 06:51 AM
Instead of using the VISIBILITY property, use the DISPLAY property.display: block;makes it visible, anddisplay: none;makes it collapse into nothingness.
<script>
function toggle() {
var dx = document.getElementById("d1").style;
if (dx.display == 'block')
{dx.display = 'none';}
else
{dx.display = 'block';}
}
</script>
<a href="#" onclick="toggle();return false">test</a><br>
<div id="d1" style="display: block">This is the DIV</div>
Stuff after the DIV