61,112
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="css/bootstrap.css" rel="stylesheet" />
<script src="JSript/jquery-2.1.4.js"></script>
<script src="JSript/bootstrap.js"></script>
<script>
$(function () {
$('tr').mouseover(function (event) {
$('#divtips').text($(this).text());
});
$('.first').mouseover(function (event) {
$('#divtips').text($(this).text());
});
$('.second').mouseover(function (event) {
event.stopPropagation();//阻止事件冒泡
$('#divtips').text($(this).text());
});
});
</script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<table class="table table-bordered">
<tr>
<td class="first">
第一个tr 第1个td 触发
</td>
<td class="first">
第一个tr 第2个td 触发
</td>
<td class="first">
第一个tr 第3个td 触发
</td>
</tr>
<tr>
<td class="second">
第二个tr 第1个td
</td>
<td class="second">
第二个tr 第2个td
</td>
<td class="second">
第二个tr 第3个td
</td>
</tr>
</table>
</div>
<div class="col-md-12" id="divtips">
</div>
</div>
</div>
</body>
</html>
onmouseover="this.bgColor='green'" onmouseout="this.bgColor=''">Menu Item1 | Menu Item2 |
---|