[英]Displaying Data in tree View on a php page
I have a site(Php and Javascript), On the Left side i want to dispaly categories and corresponding SubCategories. 我有一个网站(Php和Javascript),在左侧我想显示类别和相应的SubCategories。
The tree should be movable something like as on this link http://www.xtlinks.com/articles/ 该树应该是可移动的,例如此链接http://www.xtlinks.com/articles/
Please suggest what should i do. 请建议我该怎么办。
Check out A List Apart - lots of good examples on there. 查看A List Apart-那里有很多很好的例子。
For the collapse affect look at the .slide() method of jQuery 对于崩溃影响,请查看jQuery的.slide()方法。
These two links explain the things really well. 这两个链接可以很好地说明问题。
http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html
http://code.stephenmorley.org/javascript/collapsible-lists/ http://code.stephenmorley.org/javascript/collapsible-lists/
or Simply try this. 或只需尝试一下。
<html>
<head>
<script type="text/javascript">
function changeDisplayState(sBoxId)
{
if (document.getElementById) {
oBox = document.getElementById(sBoxId).style;
if (oBox.display == "none" || oBox.display == "NULL") {
oBox.display = "block";
} else {
oBox.display = "none";
}
}
}
</script>
</head>
<body>
<ul>
<li>parent 1</li>
<li><a href="javascript:changeDisplayState('childset_1')">parent 2</a>
<ul id="childset_1">
<li><a href="javascript:changeDisplayState('grandchildset_1')">child 1</a>
<ul id="grandchildset_1">
<li>grandchild 1</li>
</ul>
</li>
</ul>
</li>
</ul>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.