csdn 论坛左边的树是怎么实现的?谁给贴一段代码?感激不尽 csdn 论坛左边的树是怎么实现的?谁给贴一段代码?感激不尽 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div> <asp:TreeView ID="t" runat="server"> <Nodes> <asp:TreeNode Text="c#"> <asp:TreeNode Text="c#1"></asp:TreeNode> <asp:TreeNode Text="c#2"></asp:TreeNode> </asp:TreeNode> </Nodes> <Nodes> <asp:TreeNode Text="c++"> <asp:TreeNode Text="c++1"></asp:TreeNode> <asp:TreeNode Text="c++2"></asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView> </div> 简单实现:<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>弹出菜单</title><style type="text/css"><!-- ul a { text-decoration:none;} li { list-style:none; margin-left:16px; display:none;}--></style><script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript"><!-- $(function(){ $('ul > a').click(function(){ $(this).nextAll('li').toggle(); }); $('li').click(function(){ alert('haha') }); }); //--></script></head><body> <ul> <a href="#">我是菜单1</a> <li>我是子菜单1</li> <li>我是子菜单2</li> </ul> <ul> <a href="#">我是菜单2</a> <li>我是子菜单3</li> <li>我是子菜单4</li> </ul></body></html> csdn做的比较专业 好像没有使用jquery等js库,这种方式对新手来说比较困难,楼主可以参考我的写法,使用jquery可以比较容易的实现这个效果 记得CSDN用的是梅花雪的JS树控件。比较早期的。简单的使用还可以。复杂的情况,最好用AJAX的JS树。 不过想来梅花雪也会做一个带AJAX功能的树控件,你自己查查看吧。 现在树是 伴水做的http://bbs.csdn.net/ui/scripts/CsdnContent.js?version=2010081301 不过你可以用这个http://www.easyui.org.cn/dhatv_demo.html http://www.v-ec.com/dh20156/article.asp?id=206 jQuery 取值 批量输入数据的可输入表格,类似VB中的datagrid 如何让iframe中的页面弹出的div遮罩将iframe也罩住? 请问call(),apply()的具体用法 一段类似marquees向左移动的JS代码,在IE下正常,在FF下就没反应,兄弟们进来看看啊! ie和firefox的兼容问题 只是一个远程外链JS文件就把浏览器搞死了 高分求助 javascipt中如何引用表格对象 怎么会对象为空或没有对象呢,请高手指点下,谢了! 求助,javascript运行时间错误 javascript 对象疑惑 Html 出现滚动条怎么处理?
<div>
<asp:TreeView ID="t" runat="server">
<Nodes>
<asp:TreeNode Text="c#">
<asp:TreeNode Text="c#1"></asp:TreeNode>
<asp:TreeNode Text="c#2"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<Nodes>
<asp:TreeNode Text="c++">
<asp:TreeNode Text="c++1"></asp:TreeNode>
<asp:TreeNode Text="c++2"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>弹出菜单</title>
<style type="text/css">
<!--
ul a { text-decoration:none;}
li { list-style:none; margin-left:16px; display:none;}
-->
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
<!--
$(function(){
$('ul > a').click(function(){
$(this).nextAll('li').toggle();
});
$('li').click(function(){
alert('haha')
});
});
//-->
</script>
</head><body>
<ul>
<a href="#">我是菜单1</a>
<li>我是子菜单1</li>
<li>我是子菜单2</li>
</ul>
<ul>
<a href="#">我是菜单2</a>
<li>我是子菜单3</li>
<li>我是子菜单4</li>
</ul>
</body>
</html>
http://bbs.csdn.net/ui/scripts/CsdnContent.js?version=2010081301
http://www.easyui.org.cn/dhatv_demo.html