View Full Version : expanding/detracting in switch content script

08-26-2006, 07:18 PM
1) Script Title: Switch content script

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

When i click on one item, it expands, and remains expanded when i click the next item, and so on a so forth. How can i get the first item to detract when i click the next item i want expanded?

for example, when i click the first question on there "What is JavaScript?", it expands
then im done reading it, and want to see the next question, so i click on the next question "Difference betwen Java & JavaScript?", and it expands, but when this expands, i want the previous one to detract.

thanks, all help greatly appreciated!!

08-27-2006, 05:39 AM
From Step 1 on the Demo Page:

<script type="text/javascript">

* Switch Content script- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

var contractsymbol='- ' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='+ ' //HTML for expand symbol.

Set the highlighted variable to yes:

var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

08-27-2006, 03:20 PM
OH CRAP!!! i dont believe i didnt see that!@#$ sorry man, that was idiotic ...

wow ... i feel depressed