|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv=content-type content="text/html; charset=utf-8">
<style type=text/css>
body
{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background: #ffffff;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 70%;
width: 100%;
}
.TreeView
{
font: Verdana;
line-height: 20px;
cursor: pointer;
font-style: normal;
}
.TreeView LI
{
/* The padding is for the tree view nodes */
padding: 0 0 0 18px;
float: left;
width: 100%;
list-style: none;
}
.TreeView, .TreeView ul
{
margin: 0;
padding: 0;
}
LI.Expanded
{
background: url(minus.gif) no-repeat left top;
}
LI.Expanded ul
{
display: block;
}
LI.Collapsed
{
background: url(plus.gif) no-repeat left top;
}
LI.Collapsed ul
{
display: none;
}
.Highlighted
{
color: red;
}
.AlternateHighlight
{
color: blue;
}
</style>
<script type="text/javascript" language="javascript">
Array.prototype.indexOf = IndexOf;
//Toggles between two classes for an element
function ToggleClass(element, firstClass, secondClass, event) {
event.cancelBubble = true;
var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);
if (firstClassIndex == -1 && secondClassIndex == -1) {
classes[classes.length] = firstClass;
}
else if (firstClassIndex != -1) {
classes[firstClassIndex] = secondClass;
}
else {
classes[secondClassIndex] = firstClass;
}
element.className = classes.join(" ");
}
//Finds the index of an item in an array
function IndexOf(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item) {
return i;
}
}
return -1;
}
//The toggle event handler for each expandable/collapsable node
//- Note that this also exists to prevent any IE memory leaks
//(due to circular references caused by this)
function ToggleNodeStateHandler(event) {
ToggleClass(this, "Collapsed", "Expanded", (event == null) ? window.event : event);
}
//Prevents the onclick event from bubbling up to parent elements
function PreventBubbleHandler(event) {
if (!event) event = window.event;
event.cancelBubble = true;
}
//Adds the relevant onclick handlers for the nodes in the tree view
function SetupTreeView(elementId) {
var tree = document.getElementById(elementId);
var treeElements = tree.getElementsByTagName("li");
for (var i = 0; i < treeElements.length; i++) {
if (treeElements[i].getElementsByTagName("ul").length > 0) {
treeElements[i].onclick = ToggleNodeStateHandler;
}
else {
treeElements[i].onclick = PreventBubbleHandler;
}
}
}
</script>
</head>
<body>
@CONTENT
<script type="text/javascript" language="javascript">
SetupTreeView("TreeView");
</script>
</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.
My name is Robert Kanasz and I have been working with ASP.NET, WinForms and C# for several years.
MCSD - Web Applications
MCSE - Data Platform
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
MCSA - SQL Server 2012
MCTS - .NET Framework 3.5, ASP.NET Applications
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
- .NET Framework 4, Data Access
- .NET Framework 4, Service Communication Applications
- .NET Framework 4, Web Applications
MS - Programming in HTML5 with JavaScript and CSS3 Specialist
Open source projects:
DBScripter - Library for scripting SQL Server database objects
Please, do not forget vote