Click here to Skip to main content
15,891,409 members
Articles / Web Development / HTML

ASP Treebuilder

Rate me:
Please Sign up or sign in to vote.
4.91/5 (12 votes)
7 May 20036 min read 98.3K   1.8K   38  
Allows a developer to easily create a dynamic JavaScript tree control.
<HTML>
<HEAD>
<!--#INCLUDE FILE="include\i_treebuilder.asp" -->
<script language="javascript">
/*
	these can be modified to change tree behavior
	var bTreeMultiSelect = false;
	var bTreeAllowDeselect = false;
*/
	// preload some images	
	var Img9 = new Image();Img9.src = "images/tree/foldericon.gif";	
	var Img10 = new Image();Img10.src = "images/tree/htmlicon.gif";	
	var Img11 = new Image();Img11.src = "images/tree/openfoldericon.gif";	
	
	// define our item dispatch
	function myTreeItemDispatch(bReslect,bSelected,sKey)
	{
		if(bSelected || bReslect)
		{
			alert("You clicked - " + sKey);
		}
	}
	// assign 
	TreeItemDispatch = myTreeItemDispatch;
</script>
<TITLE>Tree Test</TITLE>
</HEAD>
<BODY style="margin: 0px; padding: 0px; background-color: #FFFFFF;">
<%
	' register our branch and leaf type
	tree_RegisterBranchType 0,"images/tree/foldericon.gif"
	tree_RegisterLeafType 0,"images/tree/htmlicon.gif"
	
	'* START OF TREE
	tree_Start "&nbsp;Personal Folders","images/tree/openfoldericon.gif"

	tree_StartBranch 0,tFALSE,"Test Folder","tst"
		tree_AddLeaf 0,tFALSE, "Child 1","tst1"
		tree_AddLeaf 0,tFALSE,"Child 2","tst2"
		tree_AddLeaf 0,tFALSE,"Child 3"	,"tst3"	
		tree_StartBranch 0,tTRUE,"Test Sub Folder","tst4"
			tree_AddLeaf 0,tFALSE,"SubChild 1","tst5"
			tree_AddLeaf 0,tFALSE,"SubChild 2","tst6"
			tree_AddLeaf 0,tFALSE,"SubChild 3"	,"tst7"
			tree_StartBranch 0,tTRUE,"Test Sub Folder2","tst8"
				tree_AddLeaf 0,tFALSE,"SubChild21","tst9"
				tree_AddLeaf 0,tFALSE,"SubChild22","tst10"
				tree_AddLeaf 0,tTRUE,"SubChild23","tst11"	
			tree_EndBranch				
		tree_EndBranch			
	tree_EndBranch
	
	tree_StartBranch 0,tTRUE,"Test Folder123","tst11"	
		tree_AddLeaf 0,tFALSE, "Child 1","tst12"	
		tree_AddLeaf 0,tFALSE,"Child 2","tst13"	
		tree_AddLeaf 0,tFALSE,"Child 3","tst14"			
		tree_StartBranch 0,tTRUE,"Test Sub Folder","tst15"	
			tree_AddLeaf 0,tFALSE,"SubChild 1","tst16"	
			tree_AddLeaf 0,tFALSE,"SubChild 2","tst17"	
			tree_AddLeaf 0,tFALSE,"SubChild 3","tst18"		
			tree_StartBranch 0,tTRUE,"Test Sub Folder2","tst19"	
				tree_AddLeaf 0,tFALSE,"SubChild21","tst20"	
				tree_AddLeaf 0,tFALSE,"SubChild22","tst21"	
				tree_AddLeaf 0,tTRUE,"SubChild23","tst22"		
			tree_EndBranch				
		tree_EndBranch				
	tree_EndBranch	
	
	'* END OF TREE
	tree_End
	
%>
</BODY>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions