日期:2014-05-17  浏览次数:20640 次

最简单的Html js做出的tree menu
<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reorder TreePanel</title>
<head>
        <script type="text/javascript">
        <!--
            function initNodes(){
            var uls = document.getElementsByTagName("ul");
            var i;
                for(i = 0; i < uls.length; i++)
                    if(uls[i].id != "root")
                        uls[i].style.display = "none";
            }

            function clickNode(id){
            var node = document.getElementById(id);
                if(node.style.display == "none")
                    node.style.display = "block";
                else
                    node.style.display = "none";
                return false;
            }
        -->
        </script>
    </head>
</head>
<body onload="initNodes()">
    Example of a tree menu
    <ul id="root">
        <li><a href="" onclick="return clickNode('r1n1')">Root 1</a>
            <ul id="r1n1">
                <li>Node 1
                </li>
                <li>Node 2
                </li>
                <li>Node 3
                </li>
            </ul>
        </li>
        <li><a href="" onclick="return clickNode('r2n1')">Root 2</a>
            <ul id="r2n1">
                <li><a href="" onclick="return clickNode('r2n1n1')">Node 1</a>
                    <ul id="r2n1n1">
    &