$(function(){// 为span元素绑定click事件$("span").bind("click",function(e){
e.stopPropagation();var text =$("#msg").html()+"<p>内层元素span被点击</p>";$("#msg").html(text);});// 为div绑定click事件$("#content").bind("click",function(e){
e.stopPropagation();var text =$("#msg").html()+"<p>外层元素div被点击</p>";$("#msg").html(text);});// 为body绑定click事件$("body").bind("click",function(e){
e.stopPropagation();var text =$("#msg").html()+"<p>body元素被点击</p>";$("#msg").html(text);});});