2011-11-03 86 views
0

我有一个网站(PHP和Javascript),在左侧我想显示类别和相应的SubCategories。在树上显示数据在php页面上查看

树应该是可移动的像作为这个链接http://www.xtlinks.com/articles/

请建议我应该怎么做。

+0

本网站上没有树。你是在谈论他们的主页http://www.xtlinks.com?然后你可以使用多个UL – NCode

+0

@NCode我想创建一个理想的可移动控件就像顶级类别涵盖链接提供的类别列表 – Mohit

+0

@nickb我没有从我应该从哪里开始 – Mohit

回答

0

的.slide()方法,这两个环节上解释了事情真的很好。

http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html

http://code.stephenmorley.org/javascript/collapsible-lists/

或者干脆试试这个。

<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>