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);
                       }
                    });
            });

  • 相关阅读:
    mvc 当中 [ValidateAntiForgeryToken] 的作用 转载https://www.cnblogs.com/hechunming/p/4647646.html
    ASP.NET MVC学习系列(一)-WebAPI初探
    ASP.NET MVC学习系列(二)-WebAPI请求 转载https://www.cnblogs.com/babycool/p/3922738.html
    MVC和WebApi 使用get和post 传递参数。 转载https://blog.csdn.net/qq373591361/article/details/51508806
    Web API与AJAX:理解FormBody和 FormUri的WebAPI中的属性
    webApi之FromUri和FromBody区别
    C#进阶系列——WebApi 接口返回值不困惑:返回值类型详解 转载 https://www.cnblogs.com/landeanfen/p/5501487.html
    JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(三):两个Viewmodel搞定增删改查
    PHP 生成唯一的激活码
    C++ virtual继承
  • 原文地址:https://www.cnblogs.com/jsingleegg/p/5029265.html
Copyright © 2011-2022 走看看