jsp页面显示指定文字,多余的用...代替,鼠标指着会显示全部内容
<%@ page pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <%@ include file="/common/taglib.jsp"%> <script type="text/javascript"> $(document).ready(function() { table = $(".scroll_table").scrolltable({ multiselect : false, height : 380 }); }); function showRealNameContent(obj, value) { obj.title = value; } </script> <table class="scroll_table" border="0" cellspacing="0" cellpadding="0" width="100%"> <thead> <tr> <th>网吧编号</th> <th>网吧名称</th> <th>剩余点数</th> </tr> </thead> <s:iterator id="obj" value="#request.searchDto.resultList"> <tbody> <tr resid="${request.obj.id}" id="tr${request.obj.id}"> <td>${request.obj.serviceCode} </td> <td onmouseover="showRealNameContent(this,"${request.obj.serviceName}")"> <s:if test="#request.obj.serviceName.length()>9"> <s:property value="#obj.serviceName.substring(0,9)"/>... </s:if> <s:else> ${request.obj.serviceName} </s:else> </td> <td>${request.obj.chargeCount} </td> </tr> </tbody> </s:iterator> </table> <displaywrap:pagination name="_pagination" requestURI="" formId="" append="" loadFunction="loadingFunc" submitCall="searchQuery" />
其中:关键代码:
function showRealNameContent(obj, value) { obj.title = value; }
<td onmouseover="showRealNameContent(this,"${request.obj.serviceName}")"> <s:if test="#request.obj.serviceName.length()>9"> <s:property value="#obj.serviceName.substring(0,9)"/>... </s:if> <s:else> ${request.obj.serviceName} </s:else> </td>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: CSS实现限制页面显示字数,超出部份显示点点点.
- 下一篇: css div多余文字用省略号代替