近来在做项目,遇到onmouseover,onmouseout事件冒泡,解决方法如下
html如下:
1 <div onclick="javascript:host.hostgroup()" class="Special1" onmouseover="mouseOverBackground(this,event)"
2 onmouseout="mouseOutBackground(this,event)">
3 <div class="navagate_title" style="height: 40px;">
4 <p>
5 主机分组</p>
6 </div>
7 <div class="navagate_middle" style="height: 20px;">
8 <span>统一管理集群方案中的主机</span>
9 </div>
10 <div class="navagate_bottom" style="height: 62px;">
11 <img src="images/index_title_1.png" alt="主机分组" />
12 </div>
13 </div>
javascript如下:
1 function mouseOverBackground(obj, e) {
2 if (isMouseLeaveOrEnter(e, obj)) {
3 $(obj).css('background', 'url(images/kuaijiebghover.png) no-repeat 0 0');
4 }
5 }
6
7 function mouseOutBackground(obj, e) {
8 if (isMouseLeaveOrEnter(e, obj)) {
9 $(obj).css('background', 'url(images/kuaijiebg.png) no-repeat 0 0');
10 }
11 }