亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js事件冒泡實(shí)例分享(已測(cè)試)

 更新時(shí)間:2013年04月23日 16:34:08   作者:  
js事件冒泡實(shí)例:摘的網(wǎng)上的例子,但是他寫的有錯(cuò)誤,自己改正了下,已驗(yàn)證通過,感興趣的朋友可以參考下哈
網(wǎng)上的例子用的是$(".b").live("click",function(event){} ,jquery自動(dòng)對(duì)live做了處理,阻止了事件冒泡。改成bind,實(shí)驗(yàn)就能通過。
復(fù)制代碼 代碼如下:

< !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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
<script type="text/javascript" src="http://www.css88.com/tool/css3Preview/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function(){
$(".b").bind("click",function(event){
$(this).css("color","#FF3300");
event.stopPropagation()//注釋掉,<SPAN style="BACKGROUND-COLOR: rgb(255,255,255)">效果是不一樣的。</SPAN>
})
});
</script>
</head>
<body>
<div id="temp"></div>
<div class="b" style="background:#3ff333">wrapwrapwrapwrapwrapwrapwrap
<div style="background:#ffff11" class="b">這是公告標(biāo)題1</div>
<div style="background:#ffff11" class="b">這是公告標(biāo)題2</div>
<div style="background:#ffff11" class="b">這是公告標(biāo)題3</div>
<div style="background:#ffff11" class="b">這是公告標(biāo)題4</div>
wrapwrapwrapwrapwrapwrapwrap
</div>
</body>
</html>

以上代碼中添加與否
復(fù)制代碼 代碼如下:

event.stopPropagation();

相關(guān)文章

最新評(píng)論