Hi all,
Really new to javascript and was hoping y’all could help me with a bit of trouble I’m having.
I’m using the script below to toggle 5 DIV tags independently on click:
[CODE]// JavaScript Document
function toggleSpecific(elementid) {
var node = document.getElementById(elementid);
if(node.style.display == ”) {
node.style.display=’none’;
}
else {
node.style.display = ”;
}
}
[CODE]<div id=”hide1″ style=”display:none; width:275px; position:relative; top:30px; left:30px;”>
<img style=”float:left; position:relative; top:37px;” src=”images/arrow_left.png” width=”11″ height=”20″ alt=”Arrow” />
<div class=”info_box_left”>
<img style=”float:left; margin:0px 10px 0px 0px” src=”images/thumb_sample.jpg” width=”64″ height=”76″ alt=”Sample Image” /><strong>Headline Goes Here</strong><br />
Sample body copy goes here
</div>
</div>
The issue I’m trying to solve is how do I get only a single DIV to show at any time. So, if you open hidden info(1) and then click the button for hidden info(2), hidden info(1) disappears and hidden info(2) displays.
All your feedback is appreciated.
Thanks!