Using JavaScirpt we can easily implement trees in HTML, without using ASP, JSP, PHP, etc., of course, if you want to combine with the database, the following code is easy to transplant.
First, let's take a look at the JavaScript code that implements this tree structure.
Common.js
! <- function showCurrentSection () {var objCurrentSection = document.getElementById ( "navcurrentsection"); if (objCurrentSection = null!) {ObjCurrentSection.style.display = "block"; objCurrentSection.parentElement.childNodes [0] .className = "open"; if (objcurrentsection.parentelement.parentelement.nodeename == "ul") showsection (ObjcurrentSection.parentelement.parentelement);}}
function showSection (objSection) {objSection.style.display = "block"; objSection.parentElement.childNodes [0] .className = "open";! if (objSection.parentElement.parentElement = null && objSection.parentElement.parentElement.nodeName = = "Ul") showsection (Objsection.parentelement.parentelement);} ->
Below is a static HTML file that implements the tree, it is very simple.
EXAMPLE1.HTML
" HTML XMLNS = "http : //www.w3.org/1999/xhtml "XML: lang =" en "lang =" en ">