jquery隔行变色,滑过变色,点击变色

<!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>
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){   
    $("ul li:nth-child(2n)").addClass("tab");
    $("ul li").hover(function(){
        $(this).addClass("hover");
    },function(){
        $(this).removeClass("hover");
    }).click(function(){
        $("ul li").removeClass("cik");
        $(this).addClass("cik");
    });
});
</script>
<style>
ul,li{margin:0; padding:0; list-style:none;}
ul{border:1px solid #ccc; padding:10px;}
ul li{height:25px; line-height:25px; clear:both;}
ul li.tab{background:#eee;}
ul li.hover{background:#FEF6DC; color:#black;}
ul li.cik{background:#FEF6DC; color:#black;}
</style>
</head>

<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
</body>
</html>

你可能感兴趣的:(html,jquery,function,XHTML,文档,border)