html顯示長度較大的數(shù)據(jù)時的處理方法

字號:


    在html中顯示長度較大的數(shù)據(jù)時,可以將數(shù)據(jù)截取顯示,當鼠標滑過時再顯示完整數(shù)據(jù)。
    例如,下面這種情況。
    實現(xiàn):
    代碼如下:
    <a>
    <c:if test="${fn:length(siteBoardInfoList.boardUrl) >= 40}">
    ${fn:substring(siteBoardInfoList.boardUrl,0,20)}......${fn:substring(siteBoardInfoList.boardUrl,fn:length(siteBoardInfoList.boardUrl)-21,fn:length(siteBoardInfoList.boardUrl))}
    </c:if>
    <c:if test="${fn:length(siteBoardInfoList.boardUrl) < 40}">
    ${siteBoardInfoList.boardUrl}
    </c:if>
    </a>