【发布时间】:2012-06-13 04:16:22
【问题描述】:
大家好,我正在尝试为每个 HTML table cell 创建工具提示,你们知道我如何在此处获取 td 属性 ID
非常感谢 jquery代码示例
$(function () {
$(".test").hover(
function () {
var toolTipHtml = $("#ToolTipDiv").clone();
$(this).append(toolTipHtml);
toolTipHtml.show("slow");
},
function () {
var toolTipHtml = $(this).find(".tooltip");
toolTipHtml.hide();
toolTipHtml.remove();
}
);
});
echo "<table>";
while($row = mysql_fetch_array($result))
{
$id = $row['id_out_org'];
echo "<tr>";
echo "<td>" .$row['KG']."</td>";
echo "<td class='test'>" .$row['B']."</td>";
echo "<td >" .$row['B']."</td>";
echo "<td class='test'>";
echo "<div id = 'ToolTipDiv' class='tooltip' style='background-color: White; display: none; width: 20%;'>";
echo "Total: $ "; echo $totalp = $total + $fuel;
echo "</div>";
"</td>";
echo "</tr>";
}
echo "</table>";
【问题讨论】:
-
你是如何在 hoover、onclick 上激活工具提示的......
-
你最好使用下面的开源插件docs.jquery.com/Plugins/Tooltip。它满足您的需求。
标签: php jquery mysql html show-hide