PDA

View Full Version : show hide content and is above previous content?



ranteo
16 Apr 2010, 03:03 PM
Hi, I have a slight problem.

I want to use js to show and hide content, and any content that is shown is above/overwrites the previous content.

I'm using the following js code.

<script type="text/javascript" language="JavaScript"><!--
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//--></script>

What happens is that I click on div1, div1 appears. I click on div2, and it overwrites div1, but if I click back on div1 again, nothing happens. I have to hide div2 before div1 can be seen.

Help? Thanks!