View Full Version : Switch Content Script: About Contract All and Expand All, Need Help!

11-02-2006, 03:51 AM

I am using the script from this link below and I am trying to figure out this:

Is there a way to hide and show the "Contract All" and "Extract All" from each other? It's kind of hard to explain, but let's say there are no content to extract, the link "Contract All" won't appear and when there is, the link will show. Pretty much toggle between the two links. Is there a way to do it? I hope this isn't too confusing.

Here is the link to the script I am basing off from:


Thanks. I appriciate it.

***EDIT: Shoot, didn't realize there was a separated section for Dynamic Drive scripts. Sorry about that!

11-02-2006, 04:17 AM
I don't think this is the correct place for posting DD Scripts related problems.

The toggling between the contract all | expand all links can be done using the following steps

1. Insert the following javascript function inside the head section

function visible(p)
document.getElementById('expand').style.visibility = "hidden";
document.getElementById('contract').style.visibility = "visible";
document.getElementById('expand').style.visibility = "visible";
document.getElementById('contract').style.visibility = "hidden";

2. Edit the contract all | expand all link part like the following

<!--Optional Expand/ Contact All links. Remove if desired-->
<div><a id="contract" href="javascript:sweeptoggle('contract')" onClick="visible(0);">Contract All</a> | <a id="expand" href="javascript:sweeptoggle('expand');" onClick="visible(1);">Expand All</a></div>

This will perform the toggling upto a point.

11-02-2006, 02:16 PM
Thanks! With this I was able to get as further as I needed. I appriciate it!