JQuery隔行变色

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        .one {
            color:green;
            /*background-color:black;*/
        }
        .two {
            color:red;
            /*background-color:red;*/
        }
    </style>
    <script src="Js/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".alone").children("div:first").css("background-color", "#fcfcfc");
            $(".alone").children("div:even").addClass("one");
            $(".alone").children("div:odd").addClass("two");
        });

    </script>
</head>
<body>
    <div class="alone">
    <div>0000000</div>
    <div>1111111</div>
    <div>2222222</div>
    <div>3333333</div>
    <div>4444444</div>
    <div>5555555</div>
    <div>-------</div>
    <div>6666666</div>
    </div>
</body>
</html>

排除第一行变色,剩下的都变色

 

posted @ 2014-12-24 19:02  Wangyk  阅读(294)  评论(0编辑  收藏  举报