HTML树形菜单伸缩问题

html-css018

HTML树形菜单伸缩问题,第1张

<br><SPAN><IMG id="Image_Closed" style="DISPLAY: none" onclick="this.style.display='none'

Text_Closed.style.display='inline'

Image_Open.style.display='inline'

Text_Open.style.display='inline'"

src="pic/m_o.gif"><IMG id="Image_Open<%= i %>" onclick="this.style.display='none'

Image_Closed.style.display='inline'

Text_Open.style.display='none'

Text_Closed.style.display='inline'"

src="pic/m_c.gif"></SPAN>

<SPAN id="Text_Closed">大目录

<SPAN id="Text_Open" style="DISPLAY: none">'主要是这句话进行修改下

<SPAN>

<br> <IMG src="pic/m_c.gif" />小目录<br>

</SPAN>

</SPAN>

</SPAN>

用z-tree插件

①带有父子关系的标准

zTreeNodes

举例:

Js代码

1.var zTreeNodes = [

2.{"id":1, "name":"test1", "nodes":[

3.{"id":11, "name":"test11", "nodes":[

4.{"id":111, "name":"test111"}

5."id":12, "name":"test12"}

②带有父子关系的简单

Array

格式

(isSimpleData)的zTreeNodes

举例:

Js代码

1.var treeNodes = [

2. {"id":1, "pId":0, "name":"test1"},

3.{"id":11, "pId":1, "name":"test11"},

4. {"id":12, "pId":1, "name":"test12"},

5. {"id":111, "pId":11, "name":"test111"},

例子:

(Java代码)

①在页面引用

zTree的js和css:

Html代码

1.

<!-- ZTree树形插件 -->

2.<link

rel="stylesheet"

href="<%=root%>/Web/common/css/zTreeStyle/zTreeStyle.css"type

="text/css">

3.<!-- <link rel="stylesheet" href="<%=root%>/Web/common/css/zTreeStyle/zTreeIcons.css" type="text/css"> -->

4.<script ype="text/javascript"src="<%=root%>/Web/common/js/jquery-ztree-2.5.min.js"

></script>

详细内容那用DIV接收,定义ID,点击的时候把内容给这个DIV就是了

var d= document.createElement("div")

d.innerHTML="显示的一句话"