warhin 2014-04-25
代码如下:
<head> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> </head> <body> <table> <tr> <td><span>冒泡事件测试</span></td> </tr> </table> </body>
代码如下:
<script type="text/javascript">
$(function () {
$("table").click(function () { alert("table alert"); });
$("td").click(function () { alert("td alert"); });
$("span").click(function (){
alert("span alert");
});
});
</script> 代码如下:
<script type="text/javascript">
$(function () {
$("table").click(function () { alert("table alert"); });
$("td").click(function () { alert("td alert"); });
$("span").click(function (e){
alert("span alert");
e.stopPropagation();
});
});
</script> 代码如下:
$("a").click(function (e) {
alert("默认行为被禁止喽");
e.preventDefault();
});
<a href="http://www.baidu.com">测试</a> 代码如下:
if (ret===false){
event.preventDefault();
event.stopPropagation();
} <table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%&qu