yipsv
asked on
JavaScript & DHTML Tree List
I have tried to build a 3 level collapse tree list, but I can only click and expand the first level. Do anyone know how to build a expandable tree or any tool out there to help me build the JavaScript and DHTML.
I will be very appriciated for your help.
//--------The gr1_srv1 & grl_srv2 can not expand.
//The output should look like this after expand.
Level 1.0
.level 2.0
.level 3.0
.level 3.1
.level 2.1
.level 3.0
.level 3.1
Level 1.1
...
...
//---here is my code
<HTML>
<HEAD>
<TITLE> List testing</TITLE>
<STYLE>
SPAN {font-size: 14pt; text-decoration: underline; color: blue; cursor: hand}
DIV {font-size: 10pt; cursor: hand}
.on {display: on}
A {text-decoration: none}
A:hover {color: red; text-decoration: underline;}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
//set bSupportsDHTML to true for IE 4 or later.
var bDoesDHTML = ( (navigator.userAgent.index Of("MSIE") >= 0)
&& (navigator.appVersion.subs tring(0,1) >= 4) )
if (bDoesDHTML) {document.write("<STYLE>.o ff{display :none}</ST YLE>")}
function doSection(secNum) {
if (bDoesDHTML) {
if (secNum.className=="off") {secNum.className="on"}
else {secNum.className="off"}
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<SPAN onclick="doSection(group1) "><B>Group 1 </B></SPAN><BR>
<DIV CLASS="off" ID="group1">
<DIV CLASS="off" onclick="doSection(g1_srv1 )">Server 1 <BR>
<DIV CLASS="off" ID="g1_srv1">
<A HREF="rightFrame.html" TARGET="right">Allocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Unallocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Spare Drives </A>
</DIV>
</DIV>
DIV CLASS="off" onclick="doSection(g1_srv2 )">Server 2 <BR>
<DIV CLASS="off" ID="g1_srv2">
<A HREF="rightFrame.html" TARGET="right">Allocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Unallocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Spare Drives </A>
</DIV>
</DIV>
</DIV>
<SPAN onclick="doSection(group2) "><B>Group 2 </B></SPAN><BR>
<DIV CLASS="off" ID="group2">
<A HREF="allocatedDrives.html " TARGET="right">Server 1 </A><BR>
<A HREF="unallocatedDrives.ht ml" TARGET="right">Server 2 </A><BR>
<A HREF="spareDrives.html" TARGET="right">Server 3 </A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients </A><BR>
</DIV>
<SPAN onclick="doSection(group3) "><B>Group 3</B></SPAN><BR>
<DIV CLASS="off" ID="group3">
<A HREF="allocatedDrives.html " TARGET="right">Server 1</A><BR>
<A HREF="unallocatedDrives.ht ml" TARGET="right">Server 2</A><BR>
<A HREF="spareDrives.html" TARGET="right">Server 3</A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients</A> <BR>
</DIV>
<SPAN onclick="doSection(group4) "><B>Group 4</B></SPAN><BR>
<DIV CLASS="off" ID="group4">
<A HREF="allocatedDrives.html " TARGET="right">Server 1</A><BR>
<A HREF="unallocatedDrives.ht ml" TARGET="right">Server 2</A><BR>
<A HREF="spareDrives.html" TARGET="right">Server 3</A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients</A> <BR>
</DIV>
</BODY>
</HTML>
</HEAD>
</HTML>
I will be very appriciated for your help.
//--------The gr1_srv1 & grl_srv2 can not expand.
//The output should look like this after expand.
Level 1.0
.level 2.0
.level 3.0
.level 3.1
.level 2.1
.level 3.0
.level 3.1
Level 1.1
...
...
//---here is my code
<HTML>
<HEAD>
<TITLE> List testing</TITLE>
<STYLE>
SPAN {font-size: 14pt; text-decoration: underline; color: blue; cursor: hand}
DIV {font-size: 10pt; cursor: hand}
.on {display: on}
A {text-decoration: none}
A:hover {color: red; text-decoration: underline;}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
//set bSupportsDHTML to true for IE 4 or later.
var bDoesDHTML = ( (navigator.userAgent.index
&& (navigator.appVersion.subs
if (bDoesDHTML) {document.write("<STYLE>.o
function doSection(secNum) {
if (bDoesDHTML) {
if (secNum.className=="off") {secNum.className="on"}
else {secNum.className="off"}
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<SPAN onclick="doSection(group1)
<DIV CLASS="off" ID="group1">
<DIV CLASS="off" onclick="doSection(g1_srv1
<DIV CLASS="off" ID="g1_srv1">
<A HREF="rightFrame.html" TARGET="right">Allocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Unallocated
<A HREF="rightFrame.html" TARGET="right">Spare Drives </A>
</DIV>
</DIV>
DIV CLASS="off" onclick="doSection(g1_srv2
<DIV CLASS="off" ID="g1_srv2">
<A HREF="rightFrame.html" TARGET="right">Allocated Drives </A>
<A HREF="rightFrame.html" TARGET="right">Unallocated
<A HREF="rightFrame.html" TARGET="right">Spare Drives </A>
</DIV>
</DIV>
</DIV>
<SPAN onclick="doSection(group2)
<DIV CLASS="off" ID="group2">
<A HREF="allocatedDrives.html
<A HREF="unallocatedDrives.ht
<A HREF="spareDrives.html" TARGET="right">Server 3 </A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients </A><BR>
</DIV>
<SPAN onclick="doSection(group3)
<DIV CLASS="off" ID="group3">
<A HREF="allocatedDrives.html
<A HREF="unallocatedDrives.ht
<A HREF="spareDrives.html" TARGET="right">Server 3</A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients</A>
</DIV>
<SPAN onclick="doSection(group4)
<DIV CLASS="off" ID="group4">
<A HREF="allocatedDrives.html
<A HREF="unallocatedDrives.ht
<A HREF="spareDrives.html" TARGET="right">Server 3</A><BR>
<A HREF="rightFrame.html" TARGET="right">Clients</A>
</DIV>
</BODY>
</HTML>
</HEAD>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the good links info. They are very helpful.
All 3 of 'em have great menu's.
I can't give you my own source for expandable menu's....because they are scrambled up (for copyright stuff etc.), so no-one else can use 'em.