jquery 中class操作的方法
实现选择当前li当前li的class="sty"其它的为class=""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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 li { list-style:none; line-height:20px; float:left; margin:0px 10px}
.sty { background-color:#F00}
</style>
<script type="text/javascript" language="javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("ul>li").click(function(){
$("ul>li").removeClass("sty");
$(this).addClass("sty");
});
$("ul>li").click(function(){
$(this).addClass("sty").siblings().removeClass("sty");
});
});
</script>
</head>
<body>
<ul>
<li class="sty">aaa</li>
<li >bbb</li>
<li >ccc</li>
</ul>
</body>
</html>