<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<title>无限级树形菜单</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<link type="text/css" rel="stylesheet" href="css/css4cnltreemenu.css" />
<script type="text/javascript" src="js/js4cnltreemenu.js"></script>
<script type="text/javascript">
var plates =[{
"name":"频道管理",
"index":"1",
"url":"http://www.baidu.com",
"child":
[
{"name": "资讯频道管理","index": "5","url":"http://www.baidu.com"},
{"name":"新闻频道管理","index":"6","url":"http://www.baidu.com"}
]
},
{
"name":"权限管理",
"index":"2",
"url":"http://www.baidu.com",
"child":
[
{"name":"添加管理员","index":"7","url":"http://www.baidu.com"},
{"name":"添加权限","index":"8","url":"http://www.baidu.com"}
]
},
{
"name":"工具管理",
"index": "3",
"url":"http://www.baidu.com"
},
{
"name": "栏目管理",
"index": "4",
"url":"http://www.baidu.com"
}
];
var html="<ul><li class='Opened'><a href=''>首页</a>";
function show(json)
{
for(var plate in json)
{
html +="<ul>";
html +="<li><a href='"+json[plate].url+"'>"+json[plate].name+"</a>";
if(json[plate].child)
{
show(json[plate].child);
}
html +="</li>"
html +="</ul>";
}
}
</script>
</head>
<body>
<p>实例演示:</p>
<div class="CNLTreeMenu" id="CNLTreeMenu1">
</div>
<script type="text/javascript">
show(plates);
document.getElementById("CNLTreeMenu1").innerHTML =html+"</li><ul>";
var MyCNLTreeMenu1=new CNLTreeMenu("CNLTreeMenu1","li");
MyCNLTreeMenu1.InitCss("Opened","Closed","Child","css/s.gif");
</script>
</div>
</body>
</html>
- 1
- 2
前往页