2012-06-06 51 views
5

我能夠以表格格式顯示jsp頁面中的動態值。並且我想實現mouseover/hover函數(在jQuery中)來顯示每個在我的錶行的詳細信息(在jsp頁面)。我是分享一些代碼在這裏:使用工具提示顯示錶格的行細節(jQuery)

<table name="table" id="table" class="table" cellpadding="4" cellspacing="2" border="1" bgcolor="" > 
<tr> 
<th><input type="checkbox" name="allCheck" onclick="selectallMe()"></th> 
<th>Emp ID</th> 
<th>Emp Name</th> 
</tr> 
<tr class="tr" id="tr"> 
<%while(rs.next()){ %> 
<td><input type="checkbox" name="chkName" onclick="selectall()"></td> 
<td><input type="text" name="empId" value="<%= rs.getString(1)%>" disabled="disabled" maxlength="10"></td> 
<td><input type="text" name="empName" value="<%= rs.getString(2)%>" disabled="disabled" maxlength="10"></td> 
</tr> 
<% } %> 
</table> 

對於這一點,我將不得不使用jQuery的DataTable和鼠標懸停()/懸停或別的東西。

什麼應該是正確的方法?

回答

4

看看下面的鏈接,將解釋有關鼠標懸停多,

http://jqfaq.com/how-to-highlight-rows-in-a-table-on-mouse-hover/

你,可以很容易地獲得_mousehover這是在上面的鏈接中使用該行的細節。你可以展示它。你想在工具提示中顯示嗎?

編輯:這裏就是這樣,在mousehover提示使用TR信息,

// Do this in _mousehover 
$currentRow = $(event.target).closest('tr'); 
$currentRow.attr("title", $currentRow.attr("id")); 

注:該樣品不具有ID爲TR。所以,你必須添加它。

+0

感謝您的回覆,如果它的工具提示(在mouseover()),它會沒事的。 – shubhanshu

+0

剛纔,我更新了我的答案。 –

+0

感謝您的更新,如果您精心地展示了jquery函數如何在這裏應用(如果需要的話,使用工具提示),這對我來說很有幫助,坦率地說....我正在學習jquery。 – shubhanshu