shu*_*shu 5 jquery jquery-ui jquery-plugins
我能够以表格格式在jsp页面中显示动态值.我想实现mouseover/hover函数(在jQuery中)以显示我的表中的每一行详细信息(在jsp页面中).我正在共享一些代码在这里:
<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>
Run Code Online (Sandbox Code Playgroud)
为此,我是否必须使用jQuery DataTable和mouseover()/ hover或其他东西.
应该是什么样的正确方法?
看一下下面的链接,它将解释有关鼠标悬停的更多信息,
http://jqfaq.com/how-to-highlight-rows-in-a-table-on-mouse-hover/
您可以轻松获取上述链接中使用的 _mousehover 中的行的详细信息。你可以展示它。您想在工具提示中显示它吗?
编辑:这是在鼠标悬停时在工具提示中使用 tr 信息的方法,
// Do this in _mousehover
$currentRow = $(event.target).closest('tr');
$currentRow.attr("title", $currentRow.attr("id"));
Run Code Online (Sandbox Code Playgroud)
注意:在该示例中没有 tr 的 id。所以,你必须添加它。