zoukankan      html  css  js  c++  java
  • tab奇偶行颜色交替+插件

    (function($){
    $.fn.tableUI=function(options){
          var defaults={
             evenRowclass:"evenRow",
             oddrowclass:"oddRow",
             activeRowClass:"activeRow"
             } 
         var options=$.extend(defaults,options);  
         this.each(function(){     //each历编
                            thistable=$(this);
                            thistable.find("tr:even").addClass(options.evenRowclass);  
                            thistable.find("tr:odd").addClass(options.oddrowclass);
                            
                            });
        //鼠标经过,离开的tr的变化
        thistable.find("tr").bind("mouseenter mouseleave",function(e){
        $(this).toggleClass(options.activeRow);                                                   
                                                                                       });  
          
    }
        
    })(jQuery);

    上是tableUI.js

     以下是html页面

    <!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=gb2312" />  
    <title>无标题文档</title>  
    <script type="text/javascript" src="jquery.min.js"></script>  
    <script type="text/javascript" src="tableUI.js"></script>  
    <script>  
    $(document).ready(function (){  
        $('#tbl, #tbl2').tableUI();  
    });  
    </script>  
    <style>  
    .evenRow{background-color:#FFCCCC;}  
    .oddRow{background-color:#CCCCCC;}  
    .activeRow{background-color:#CCCCFF;}  
    </style>  
    </head>  
      
    <body>  
    <table id="tbl" style="400px;" border="5px">  
        <tr>  
            <td><span style="border:1px solid red; display:block;">1111111111111</span></td>  
            <td>1111111111111</td>  
        </tr>  
        <tr>  
            <td>1111111111111</td>  
            <td>1111111111111</td>  
        </tr>  
        <tr>  
            <td>1111111111111</td>  
            <td>1111111111111</td>  
        </tr>  
        <tr>  
            <td>1111111111111</td>  
            <td>1111111111111</td>  
        </tr>  
    </table>  
    </body>  
    </html> 
  • 相关阅读:
    java导出Excel表格
    移动端下拉刷新上拉加载-mescroll.js插件
    java-生成任意格式的json数据
    原生js版分页插件
    JavaScript实现段落文本高亮
    学习表单重复提交问题
    java 数据库连接 驱动相关参数
    mybatis maven 代码生成器(mysql)
    maven国内镜像
    spring boot redis代码与配置
  • 原文地址:https://www.cnblogs.com/vania/p/3326367.html
Copyright © 2011-2022 走看看