PDA

View Full Version : SwitchContent with Unordered HTML lists <UL> ??



Treefarn
01-02-2008, 05:35 PM
1) Script Title:
Switch Content Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...tchcontent.htm

3) Describe problem:

I have an application (that unfortunately is not in production, so I can't send the webpage) that is using SwitchContent to display answers to questions. Everything works fine, unless the answer has an Unordered list in it. If the answer contains <UL> and <LI> tags, the UL and LI portions of the answer do NOT contract. ANyone else have problems with UL???

The relevant code:

<A href="javascript:togglehideshow.sweepToggle('contract')">Contract All</A> | <A href="javascript:togglehideshow.sweepToggle('expand')">Expand All</A> </div>


<p class=switchgroup1 id=bobcontent<%=x%>><%=Answer%>

<SCRIPT type=text/javascript>
var togglehideshow=new switchcontent("switchgroup1", "p")
togglehideshow.setStatus('<img src="../images/site/Eopen.gif" /> ', '<img src="../images/site/bdot.gif" /> ')
togglehideshow.setColor('darkred', '#607DA7')
togglehideshow.setPersist(true)
togglehideshow.collapsePrevious(true)
togglehideshow.init()
</SCRIPT>

ddadmin
01-03-2008, 03:18 AM
It shouldn't matter if the expanding content contains UL lists, as long as they are wrapped in the main content DIV. I just tested this out, and the below seems to work fine:


<h3 id="bobcontent2-title" class="handcursor">Difference betwen Java & JavaScript?</h3>
<div id="bobcontent2" class="switchgroup1">
Java is completely different from JavaScript.
The former is a compiled language while the later is a scripting language.
<ul>
<li>sdff</li>
<li>sdff</li>
<li>sdff</li>
<li>sdff</li>
</ul>
</div>