NTSsupport
10-19-2005, 06:47 PM
Script: Switch Content Script
http://dynamicdrive.com/dynamicindex17/switchcontent.htm
Thanks DD for creating such a great script. I have been able to modify the script to my liking so far.
I have one small problem that I am sure someone can point out to me right away. I would like to have sub sub links under some of the headings.
This works when the variable collapseprevious set to no.
When set to yes it collapses the menu (as it is supposed to), but I don't want it to for a sub menu.
In the javascript code I have the following set:
var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)
Here is my html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="javascript" src="/scripts/menu.js"></script>
<title>Untitled Document</title>
</head>
<body>
<h3 onClick="expandcontent(this, 'sub1')"><span class="showstate"></span>Heading 1</h3>
<div id="sub1" class="switchcontent">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
<h3 onClick="expandcontent(this, 'sub2')"><span class="showstate"></span>Heading 2</h3>
<div id="sub2" class="switchcontent">
<ul>
<li onclick="expandcontent(this, 'subsub2')">Link 1</li>
<div id="subsub2" class="switchcontent">
<ul>
<li>Sub Link 1</li>
<li>Sub Link 2</li>
<li>Sub Link 3</li>
<li>Sub Link 4</li>
</ul>
</div>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
<h3 onClick="expandcontent(this, 'sub3')"><span class="showstate"></span>Heading 3</h3>
<div id="sub3" class="switchcontent">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
</body>
</html>
Any help would be greatly appreciated.
Thanks for your time and help.
http://dynamicdrive.com/dynamicindex17/switchcontent.htm
Thanks DD for creating such a great script. I have been able to modify the script to my liking so far.
I have one small problem that I am sure someone can point out to me right away. I would like to have sub sub links under some of the headings.
This works when the variable collapseprevious set to no.
When set to yes it collapses the menu (as it is supposed to), but I don't want it to for a sub menu.
In the javascript code I have the following set:
var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)
Here is my html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="javascript" src="/scripts/menu.js"></script>
<title>Untitled Document</title>
</head>
<body>
<h3 onClick="expandcontent(this, 'sub1')"><span class="showstate"></span>Heading 1</h3>
<div id="sub1" class="switchcontent">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
<h3 onClick="expandcontent(this, 'sub2')"><span class="showstate"></span>Heading 2</h3>
<div id="sub2" class="switchcontent">
<ul>
<li onclick="expandcontent(this, 'subsub2')">Link 1</li>
<div id="subsub2" class="switchcontent">
<ul>
<li>Sub Link 1</li>
<li>Sub Link 2</li>
<li>Sub Link 3</li>
<li>Sub Link 4</li>
</ul>
</div>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
<h3 onClick="expandcontent(this, 'sub3')"><span class="showstate"></span>Heading 3</h3>
<div id="sub3" class="switchcontent">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
</ul>
</div>
</body>
</html>
Any help would be greatly appreciated.
Thanks for your time and help.