<!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>
<title></title>
</head>
<body>
<div id="content">
外层div元素<br />
<span>内层span元素</span><br />
外层div元素
</div>
<div id="msg"></div>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("span").bind("click", mySpan = function (event, a, b) {
var txt = $("#msg").html() + "<p>内层span元素被单击<p/>";
$("#msg").html(txt);
//alert($(event.target));
event.stopPropagation();
start(event, a, b);
//return false;
})
$("span").trigger("click", ["5", "6"]);
function start(event, a, b) {
alert(a);
alert(b);
}
$("#content").bind("click", { foo: "bar" }, myFun2 = function (event) {
var txt = $("#msg").html() + "<p>外层div元素被单击<p/>";
$("#msg").html(txt);
alert(event.data.foo);
event.stopPropagation();
});
$("body").trigger("clcik");
$("body").bind("click", function () {
var txt = $("#msg").html() + "<p>body元素被单击<p/>";
$("#msg").html(txt);
event.stopPropagation();
});
$("#btn").click(function () {
$("#btn").unbind("click", myFun2);
alert("aaa");
})
})
</script>
<button id="btn">删除第二个</button>
<div id="test"></div>
</body>
</html>
![]()