日期:2014-05-16 浏览次数:20326 次
.current { color:#568800;font-weight:bold;}
.subitem a { text-decoration:none}
.subitem a:hover { text-decoration:none; color:#568800;font-weight:bold;}
<ul id="tree">
<li class="item">
2011-04-10
<ul>
<li class="subitem">调度通知说仪表科看不...</li>
<li class="subitem">调度通知192.16...</li>
</ul>
</li>
<li class="item">
2011-04-09
<ul>
<li class="subitem">调度通知 16701...</li>
</ul>
</li>
</ul>
$(".subitem").click(function (){
$(this).children().addClass("current").parent().siblings().children("a").removeClass("current");
});
.current { color:#568800;font-weight:bold;}
.subitem:hover { text-decoration:none; color:#568800;font-weight:bold;}
<ul id="tree">
<li class="item">
2011-04-10
<ul>
<li class="subitem">调度通知说仪表科看不...</li>
<li class="subitem">调度通知192.16...</li>
</ul>
</li>
<li class="item">
2011-04-09
<ul>
<li class="subitem">调度通知 16701...</li>
</ul>
</li>
</ul>
$(".subitem").click(function (){
$(this).addClass("current").parents(".item").siblings().children(".subitem").removeClass("current");
});
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
<style type="text/css">
.current
{
color: #568800;
font-weight: bold;
}
.subitem:hover
{
text-decoration: none;
color: #568800;
font-weight: bold;
}
</style>
<