PDA

View Full Version : Help configuring Switch Content Script II across table rows



diamondonwheels
12-06-2008, 12:01 AM
1) Script Title: Switch Content Script II (icon based)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm

3) Describe problem:
I have a script that automatically generates the items to be displayed/hidden. Essentially, it creates a table of two levels of members. Level 1 members are the ones personally referred, and if those members have referred other members, then it prints the members those referred.

It looks kinda like this in shorthand:
Table:
TR: Member 1 - 0 referrals
TR: Member 2 - 0 referrals
TR: Member 3 - 3 referrals
TR: Member 3's 1st referral
TR: Member 3's 2nd referral
TR: Member 3's 3rd referral
TR: Member 4 - 0 referrals
END Table

So, member 3's referrals should only display once the "plus" icon is clicked. But it's always displayed.

Please see http://freedomtax.info/auctions/test123.html

Thanks!

~Henry~

Here's how the code looks:

<html>
<title>Title</title>
<head>
<script type="text/javascript" src="http://testresource.promanageronline.com/js/switchcontent.js"></script>
<script type="text/javascript" src="http://testresource.promanageronline.com/js/switchicon.js"></script>
<table>
<tr >
<td> 1 </td>
<td> Member 1</td>
<td> 0</td>
<td> 0</td>
</tr>
<tr>
<td> 2 </td>
<td>Member 2</td>
<td> 2</td>
<td> 0</td>
</tr>
<tr>
<td> 4 <span id="202837-title" class="iconspan"><img src="plusplus.gif" /></span> </td>
<td>Member 3 </td>
<td> 2</td>
<td> 1</td>
</tr>
<div id="202837" class="icongroup1">
<tr class="foundation-level2">
<td> 4 </td>
<td> Member 3's 1st referral</td>
<td> 2</td>
<td> 0</td>
</tr> </div>
<div id="202837" class="icongroup1">
<tr class="foundation-level2">
<td> 4 </td>
<td> Member 3's 2nd referral</td>
<td> 2</td>
<td> 0</td>
</tr> </div>
<div id="202837" class="icongroup1">
<tr class="foundation-level2">
<td> 4 </td>
<td> Member 3's 3rd referral</td>
<td> 2</td>
<td> 0</td>
</tr> </div>
<tr>
<td> 5 </td>
<td>Member 4 </td>
<td> 2</td>
<td> 1</td>
</tr>
</table>
<script type="text/javascript">
var members=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
members.setHeader('<img src="minus.gif" />', '<img src="plus.gif" />') //set icon HTML
members.collapsePrevious(false) //Allow only multiple content open at any time
members.setPersist(true) //persistence enabled
members.defaultExpanded(1) //Set 1st content to be expanded by default
members.init()
</script>
test
</body>
</html>