using the DD example with new function call in red
Code:
<p><b>Example 1 (individual):</b></p>
<div style="height:50px;background-Color:red;" >
<a href="javascript:animatedcollapse.toggle('jason');Toggle('b1','On','Off');"><img src="http://www.dynamicdrive.com/dynamicindex17/toggle.jpg" border="0" /></a>
<div id="b1" >On</div>
</div>
<div id="jason" style="width: 300px; background: #FFFFCC; display:none">
<b>Content inside DIV!</b><br />
<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br />
</div>
the new function
Code:
function Toggle(id,a,b){
var obj=document.getElementById(id);
if (obj){
obj.innerHTML=obj.innerHTML==a?b:a;
}
}
better with no additional function use the script function
Code:
animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
var obj=document.getElementById('b1');
if (divobj.id=='jason'&&obj){
obj.innerHTML=state=='block'?'Off':'On';
}
and the HTML
<p><b>Example 1 (individual):</b></p>
<div style="height:50px;background-Color:red;" >
<a href="javascript:animatedcollapse.toggle('jason');"><img src="http://www.dynamicdrive.com/dynamicindex17/toggle.jpg" border="0" /></a>
<div id="b1" >On</div>
</div>
<div id="jason" style="width: 300px; background: #FFFFCC; display:none">
<b>Content inside DIV!</b><br />
<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br />
</div>
Bookmarks