码迷,mamicode.com
首页 > 其他好文 > 详细

div实现隔行变色

时间:2014-12-24 20:09:44      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

<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>

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

 

div实现隔行变色

标签:

原文地址:http://www.cnblogs.com/wykLog/p/4183178.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!