1."CNL Tree Menu"為無限級(jí)樹形,兼容以下版本的瀏覽器:IE5.0+, FF1.06+, Opera8.5+ ……
2.HTML,CSS,JavaScript代碼相互分離(即數(shù)據(jù),風(fēng)格,腳本三者分離),可應(yīng)用于多種場合,易于維護(hù)3.修改;更換樹形圖標(biāo),只需要修改CSS文件.
4.通過W3C校驗(yàn)(XHtml1-Strict,CSS1.0).
5.最后更新:2006-2-13
6.演示地址:http://cnlei.iecn.net/mycode/CNLTreeMenu/Ver1.0.2/index.html
7.下載地址:http://cnlei.iecn.net/mycode/CNLTreeMenu/CNLTreeMenuVer1.0.2.rar
實(shí)例演示:
- CNL Tree Menu Ver1.02
- Author:CNLei,楓巖
- MySite:www.cnlei.net, cnlei.iecn.net
- E-Mail:cnlei.y.l#gail.com (請將#換成@)
-
Intro:
- "CNL Tree Menu"為無限級(jí)樹形,兼容以下版本的瀏覽器:IE5.0+, FF1.06+, Opera8.5+ ……
- HTML,CSS,JavaScript代碼相互分離(即數(shù)據(jù),風(fēng)格,腳本三者分離),可應(yīng)用于多種場合,易于維護(hù)修改;更換樹形圖標(biāo),只需要修改CSS文件.
- 通過W3C校驗(yàn)(XHtml1-Strict,CSS1.0).
- 最后更新:2006-2-13
- 下載地址:點(diǎn)擊下載
CNL Tree Menu1
CNL Tree Menu2
CNL Tree Menu3
CSS Code:
.CNLTreeMenu img.s {cursor:pointer;vertical-align:middle;} .CNLTreeMenu ul {padding:0;} .CNLTreeMenu li {list-style:none;padding:0;} .Closed ul {display:none;} .Child img.s {background:none;cursor:default;} #CNLTreeMenu1 ul {margin:0 0 0 17px;} #CNLTreeMenu1 img.s {width:20px;height:15px;} #CNLTreeMenu1 .Opened img.s {background:url(skin1/opened.gif) no-repeat 0 0;} #CNLTreeMenu1 .Closed img.s {background:url(skin1/closed.gif) no-repeat 0 0;} #CNLTreeMenu1 .Child img.s {background:url(skin1/child.gif) no-repeat 3px 5px;} #CNLTreeMenu2 ul {margin:0 0 0 17px;} #CNLTreeMenu2 img.s {width:17px;height:15px;} #CNLTreeMenu2 .Opened img.s {background:url(skin2/opened.gif) no-repeat 4px 6px;} #CNLTreeMenu2 .Closed img.s {background:url(skin2/closed.gif) no-repeat 3px 6px;} #CNLTreeMenu2 .Child img.s {background:url(skin2/child.gif) no-repeat 3px 5px;} #CNLTreeMenu3 ul {margin:0 0 0 17px;} #CNLTreeMenu3 img.s {width:34px;height:18px;} #CNLTreeMenu3 .Opened img.s {background:url(skin3/opened.gif) no-repeat 0 1px;} #CNLTreeMenu3 .Closed img.s {background:url(skin3/closed.gif) no-repeat 0 1px;} #CNLTreeMenu3 .Child img.s {background:url(skin3/child.gif) no-repeat 13px 2px;}
JavaScript Code:
/***************************** JavaScript Code for CNLTreeMenu Version: Ver 1.02 Author : CNLei, 楓巖 E-Mail : CNLei.Y.L@gmail.com MySite : http://www.cnlei.net Passed : XHtml 1.0, CSS 2.0, IE5.0+, FF1.0+, Opera8.5+ Update : 2006-2-12 *****************************/ function Ob(o){ var o=document.getElementById(o)?document.getElementById(o):o; return o; } function Hd(o) { Ob(o).style.display="none"; } function Sw(o) { Ob(o).style.display=""; } function ExCls(o,a,b,n){ var o=Ob(o); for(i=0;i<n;i++) {o=o.parentNode;} o.className=o.className==a?b:a; } function CNLTreeMenu(id,TagName0) { this.id=id; this.TagName0=TagName0==""?"li":TagName0; this.AllNodes = Ob(this.id).getElementsByTagName(TagName0); this.InitCss = function (ClassName0,ClassName1,ClassName2,ImgUrl) { this.ClassName0=ClassName0; this.ClassName1=ClassName1; this.ClassName2=ClassName2; this.ImgUrl=ImgUrl || "css/s.gif"; this.ImgBlankA ="<img src=\"css/s.gif\" class=\"s\" onclick=\"ExCls(this,'"+ClassName0+"','"+ClassName1+"',1);\" alt=\"展開/折疊\" />"; this.ImgBlankB ="<img src=\"css/s.gif\" class=\"s\" />"; for (i=0;i<this.AllNodes.length;i++ ) { this.AllNodes[i].className==""?this.AllNodes[i].className=ClassName1:""; this.AllNodes[i].innerHTML=(this.AllNodes[i].className==ClassName2?this.ImgBlankB:this.ImgBlankA)+this.AllNodes[i].innerHTML; } } this.SetNodes = function (n) { var sClsName=n==0?this.ClassName0:this.ClassName1; for (i=0;i<this.AllNodes.length;i++ ) { this.AllNodes[i].className==this.ClassName2?"":this.AllNodes[i].className=sClsName; } } }