Trees Code

2 Feb

<html>
<head>

<style>
<!–
#foldheader{cursor:hand ; font-weight:bold ;
list-style-image:url(fold.gif)}
#foldinglist{list-style-image:url(list.gif)}
//–>
</style>
<script language=”JavaScript1.2″>
<!–
/**
* Based on Folding Menu Tree
* Dynamic Drive (www.dynamicdrive.com)
* For full source code, installation instructions,
* 100’s more DHTML scripts, and Terms Of
* Use, visit dynamicdrive.com
*
* Updated to support arbitrarily nested lists
* by Mark Quinn (mark@robocast.com) November 2nd 1998
*/

var head=”display:””
img1=new Image()
img1.src=”fold.gif”
img2=new Image()
img2.src=”open.gif”

function change(){
if(!document.all)
return
if (event.srcElement.id==”foldheader”) {
var srcIndex = event.srcElement.sourceIndex
var nested = document.all[srcIndex+1]
if (nested.style.display==”none”) {
nested.style.display=”
event.srcElement.style.listStyleImage=”url(open.gif)”
}
else {
nested.style.display=”none”
event.srcElement.style.listStyleImage=”url(fold.gif)”
}
}
}

document.onclick=change

//–>
</script>

</head>

<body>
<ul>
<li id=”foldheader”>Basic Function</li>
<ul id=”foldinglist” style=”display:none” style=>
<li><a href=”http://www.cnn.com”>Open</a></li&gt;
<li><a href=”http://www.abcnews.com”>Close</a></li&gt;
<li><a href=”http://www.abcnews.com”>Stop</a></li&gt;
<li><a href=”http://www.abcnews.com”>Deck A</a></li>
<li><a href=”http://www.abcnews.com”>Deck B</a></li>
<li><a href=”http://www.vancouversun.com”>Program Record</a></li>
</ul>

<li id=”foldheader”>Recording</li>
<ul id=”foldinglist” style=”display:none” style=>
<li><a href=”http://www.gamespot.com”>Program Record</a></li>
<li><a href=”http://www.happypuppy.com”>Analog Source</a></li>
<li><a href=”http://www.gamespot.com”>Digital Source</a></li>
<li><a href=”http://www.happypuppy.com”>Manual Mode & Auto Mode</a></li>
<li><a href=”http://www.happypuppy.com”>Record</a></li&gt;
<li><a href=”http://www.happypuppy.com”>1x dubbing</a></li>
<li><a href=”http://www.happypuppy.com”>2x dubbing</a></li>
<li><a href=”http://www.gamecenter.com”>Make CD</a></li>
<li><a href=”http://www.gamecenter.com”>CD sync</a></li>
<li><a href=”http://www.gamecenter.com”>Dub_2x_trk</a></li&gt;
<li><a href=”http://www.gamecenter.com”>Dub_1x_trk</a></li&gt;
<li><a href=”http://www.gamecenter.com”>Program Record 2x</a></li>
</ul>

<li id=”foldheader”>Erasing</li>
<ul id=”foldinglist” style=”display:none” style=>
<li><a href=”http://www.download.com”>Erase Disc</a></li>
<li><a href=”http://www.hotfiles.com”>Erase Last track</a></li>
<li><a href=”http://www.hotfiles.com”>DC erase</a></li>

<li id=”foldheader”>Nested</li>
<ul id=”foldinglist” style=”display:none” style=>
<li><a href=”http://www.windows95.com”>nested 1</a></li>
<li><a href=”http://www.shareware.com”>nested 2</a></li>
</ul>

<li><a href=”http://www.windows95.com”>outer 3</a></li>
<li><a href=”http://www.shareware.com”>outer 4</a></li>
</ul>
</ul>

</body>

<percede>

<script language=”JavaScript1.2″>
<!–
/**
* Get cookie routine by Shelley Powers
* (shelley.powers@ne-dev.com)
*/
function get_cookie(Name) {
var search = Name + “=”
var returnvalue = “”;
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(“;”, offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

if (get_cookie(window.location.pathname) != ”){
var openresults=get_cookie(window.location.pathname).split(” “)
for (i=0 ; i < openresults.length ; i++){
foldinglist[openresults[i]].style.display=”
document.all[foldinglist[openresults[i]].sourceIndex –
1].style.listStyleImage=”url(open.gif)”
}
}

if (document.all){
var nodelength=foldinglist.length-1
var nodes=new Array(nodelength)
var openones=”
}

function check(){
for (i=0 ; i <= nodelength ; i++){
if (foldinglist[i].style.display==”)
openones=openones + ” ” + i
}
document.cookie=window.location.pathname+”=”+openones
}

if (document.all)
document.body.onunload=check
//–>
</script>

</percede>

</html>

Demo:
trees-code.txt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: