2012-02-20 98 views
1

大家好,我想將一個<td>單元格的所有內容放入mouseOver。我正在做一個forEach來填充元素的單元格。有些單元格中有一些元素。我希望單元格中的內容也是MouseOver上的內容。我不知道如何格式化title =以適應。MouseOver標題問題

<table align="center" class="data_extract vert_scroll_table" > 
    <tr> 
     <c:forEach var="heading" items="${results.headings}"> 
      <th class="data_extract">${heading}</th> 
     </c:forEach> 
    </tr> 
    <c:forEach var="row" items="${results.data}"> 
     <tr> 
      <c:forEach var="cell" items="${row}" varStatus="rowStatus"> 
       <td class="data_extract"> 
        <c:choose> 
         <c:when test="${results.types[rowStatus.index].array}"> 
          <c:forEach var="elem" items="${cell}" varStatus="cellStatus"> 
           <span class="mouseover_text" title="${elem},&nbsp;">${elem}<c:if test="${!cellStatus.last}">,&nbsp;</c:if></span> 
          </c:forEach> 
         </c:when> 
         <c:otherwise> 
          ${cell} 
         </c:otherwise> 
        </c:choose> 
       </td> 
      </c:forEach> 
     </tr> 
    </c:forEach> 
</table> 

循環都是在這裏完成後,我基本上要:

<c:when test="${results.types[rowStatus.index].array}"> 
    <c:forEach var="elem" items="${cell}" varStatus="cellStatus"> 
     ${elem}<c:if test="${!cellStatus.last}">,&nbsp;</c:if> 
    </c:forEach> 

把這裏的結果在標題:

<span class="mouseover_text" title= </span> 

回答

0

如果我正確地理解你的問題,標題標籤在您的span標籤中沒有正確生成。

看看下面的代碼是否適合你的問題。如果不是,請更清楚地解釋一下。

<c:forEach var="elem" items="${cell}" varStatus="cellStatus"> 
    <c:choose> 
     <c:when test="${cellStatus.count ==1}> 
      <c:set var="temp" value="${elem}"/> 
     </c:when> 
     <c:otherwise> 
      <c:set var="temp" value="${temp}, ${elem}"/> 
     </c:otherwise> 
    </c:choose> 
    <span class="mouseover_text" title="${temp}">${elem}<c:if test="${!cellStatus.last}">,&nbsp;</c:if></span> 
</c:forEach>