树视图 [英] Tree view

查看:73
本文介绍了树视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试做树视图

它的工作正常但当有人点击link1或link2时页面打开它'已经打开相同的列表


如果可能的话,链接有文件链接但是目前它有选项


在32,39或46行编码仪式


[PHP]

<!DOCTYPE html PUBLIC" - / W3C / DTD XHTML 1.0 Strict / EN" " HTTP://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

< html xmlns =" http://www.w3.org/1999/xhtml" XML:朗= QUOT;恩"郎= QUOT;恩">

< head>

< title>测试< / title>

< meta http-equiv =" Content-Type"含量=" text / html的;字符集= UTF-8英寸;>

< style type =" text / css">

* {list-style:none; font:12px Tahoma; color:#567; margin:0;}

ul li ul {display:none; margin-left :10px}

ul li.active ul {display:block;}

li {clear:both; float:left; cursor:pointer}

< / style>

< script type =" text / javascript">

函数treeView(事件)

{

var target = event.target || window.event.srcElement;

if(target.tagName ==''LI'')

{

if(target.className!=''active'' )

{

target.className =''active'';

}

else

{

target.className ='''';

}

}

}

< / script>

< / head>

< body>

< ul onclick =" treeView(event)">

< li>链接1

< ul>

< li>< a href =" dsafa"> sublink< / a>< / li>

< li>< a href =" fdsa23"> sublink< / a>< / li>

< li>< a href ="#"> sublink< / a>< / li>

< / ul>

< / li>

< li> link 2

< ul>

< li>< a href ="#"> sublink< / a>< / li>

< li>< a href ="#"> sublink< / a>< / li>

< li>< a href ="#"> sublink< / a>< / li>

< / ul>

< / li>

< li>链接3

< ul>

< li>< a href ="#"> sublink< / a>< / li>

< li>< a href ="#"> sublink< / a>< / li>

< li>< a href ="#"> sublink< / a>< / li>

< / ul>

< / li>

< / ul>

< / body>

< / html>

[/ PHP]

Hi

i''m trying to do treeview
it''s working fine but when some body click on the link1 or link2 when the page open it''s bring the same list already open

if possible then the link has file link but at the moment it li options

coding rite here in line 32, 39 or 46

[PHP]
<!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
*{list-style:none;font:12px Tahoma;color:#567;margin:0;}
ul li ul{display:none;margin-left:10px}
ul li.active ul{display:block;}
li{clear:both;float:left;cursor:pointer}
</style>
<script type="text/javascript">
function treeView(event)
{
var target = event.target || window.event.srcElement;
if (target.tagName == ''LI'')
{
if (target.className!=''active'')
{
target.className=''active'';
}
else
{
target.className='''';
}
}
}
</script>
</head>
<body>
<ul onclick="treeView(event)">
<li>link 1
<ul>
<li><a href="dsafa">sublink</a></li>
<li><a href="fdsa23">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 2
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 3
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
</ul>
</body>
</html>
[/PHP]

推荐答案


当某个机构点击link1或link2时当页面打开时,它会打开已经打开的相同列表
when some body click on the link1 or link2 when the page open it''s bring the same list already open



你能解释一下你的意思吗?我不确定我是否完全按照你的说法进行操作。

Could you explain what you mean here? I''m not sure I quite follow what you''re saying.


谢谢你的回复


好​​问题是我已经得到三个链接像

[PHP]链接1

链接2

链接3 [/ PHP]在javascript中有人点击它带来的链接1子节点如


[PHP]

链接1

链接1-1

链接1- 2

链接2

链接3

[/ PHP]


iv''e得到了工作正常的代码,但点击链接1,它带来子节点


但我想同时打开一个文件&也打开子节点

当文件打开它时自动知道选择了哪个节点


我只是粘贴上面的代码如果你只需运行你知道我想要的脚本。


thx提前
Thx for kindly reply

well question is i''ve got three link like
[PHP]Link 1
Link 2
Link 3[/PHP]in javascript somebody click on Link 1 it bring subnode like

[PHP]
Link 1
Link 1-1
Link 1-2
Link 2
Link 3
[/PHP]

iv''e got the code which works fine but when click on Link 1 it''s brings the subnode

but i want same time open a file & also open subnode as well
when the file opening it''s automaticaly know which node is selected

i''ve just paste the code above if u just run the script you get know what i want.

thx in advance


你想打开哪些文件?您是要下载文件还是打算打开页面?
What file(s) would you like to open? Are you looking to download a file or do you mean opening a page?


这篇关于树视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆