<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tbody>
<tr>
<td>
事件冒泡
</td>
</tr>
</tbody>
</table>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$("tbody").click(function() {
alert("tbody");
});
$("tr").click(function() {
alert("tr");
});
$("td").click(function(e) {
alert("td");
//停止事件冒泡
e.stopPropagation();
});
});
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tbody>
<tr>
<td>
事件冒泡
</td>
</tr>
</tbody>
</table>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$("tbody").click(function() {
alert("tbody");
});
$("tr").click(function() {
alert("tr");
});
$("td").click(function(e) {
alert("td");
//停止事件冒泡
e.stopPropagation();
});
});
</script>
</body>
</html>