zoukankan      html  css  js  c++  java
  • 在一个表格里,超过一定宽度字符串进行截取显示点点,鼠标移上去显示全

        <table  style="100%" >
                                <tr>
                                    <th  style="30%">相关通用药物分类</th>
                                    <th  style="35%">用药目的(非交集用颜色区分)</th>
                                    <th  style="15%">交集类别</th>
                                     <th  style="15%">操作</th>
                                </tr>
                              <tr>
                                  <td field="name"><div class="z_cutout">xxxxxxxxxxxxxxxxxxxxxsssxxxxxxxxxxxxxxxxxxxxssssssssssss</div></td>
                                  <td field="jindu">xxx</td>                          
                                  <td field="time">包含</td>
                                  <td field="opear">
                                     <a href="#" class="z_a">删除关联</a>
                                  </td>
                              </tr>
                              <tr>
                                  <td field="name"><div class="z_cutout">xxxxxxxxxxxxxxxxxxxxxsssxxxxxxxxxxxxxxxxxxxxssssssssssss</div></td>
                                  <td field="jindu">xxx</td>                          
                                  <td field="time">包含</td>
                                  <td field="opear">
                                     <a href="#" class="z_a">删除关联</a>
                                  </td>
                              </tr>

    </table>

    $(function(){
                $(".z_cutout").each(function(i) {
                    if($(this).text().length>10){
                        $(this).attr("title",$(this).text());
                        var text = $(this).text().substring(0,10)+"...";
                        $(this).text(text);
                    }
                });
                
                $(".z_cutout").mouseenter(function()
                    { //鼠标移入
                        var title  = $(this).attr("title");
                        $(this).text(title);
                    }).mouseleave(function()
                    { //鼠标移出
                        if($(this).text().length>10){
                        var text = $(this).text().substring(0,10)+"...";
                        $(this).text(text);
                       }
                    });
            });

  • 相关阅读:
    Codeforces 294B Shaass and Bookshelf:dp
    Codeforces 372B Counting Rectangles is Fun:dp套dp
    Codeforces 402D Upgrading Array:贪心 + 数学
    Codeforces 571B Minimization:dp + 贪心【前后相消】
    Codeforces 509F Progress Monitoring:区间dp【根据遍历顺序求树的方案数】
    codeforces 447E or 446C 线段树 + fib性质或二次剩余性质
    类斐波那契数列的一些性质
    CF 1097D
    最近点对问题
    2018ACM-ICPC EC-Final 现场赛I题 Misunderstanding...Missing 倒着DP
  • 原文地址:https://www.cnblogs.com/jsingleegg/p/5029265.html
Copyright © 2011-2022 走看看