最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript onmouseout 解決辦法

 更新時(shí)間:2010年07月17日 17:49:25   作者:  
最近在做一個(gè)簡(jiǎn)單的鼠標(biāo)onmouseover時(shí)顯示層(層里面有多個(gè)鏈接文字),onmouseout 時(shí)隱藏層的功能時(shí),發(fā)現(xiàn)有諸多問(wèn)題.
onmouseout 發(fā)現(xiàn)它的觸發(fā)太敏感,當(dāng)經(jīng)過(guò)層內(nèi)文字鏈時(shí),即觸發(fā)onmousetout事件,功能不能正常顯示,經(jīng)過(guò)一番搜索,整理出來(lái),供大家參考。

1、
復(fù)制代碼 代碼如下:

<script type="text/javascript">
  function test(obj, e) {
    if (e.currentTarget) {
  if (e.relatedTarget != obj) {
   if (obj != e.relatedTarget.parentNode) {
  alert(1);
  }
  }
  } else {
  if (e.toElement != obj) {
  if (obj != e.toElement.parentNode) {
  alert(1);
  }
  }
  }
  }
</script>
  <div onmouseout="test(this, event)" style="width:100px;height:100px;border:1px #666 solid">
    <span style="margin:5px;width:100%;height:100%;border:1px #ff0000 solid">faddsf</span>  </div>

2、
復(fù)制代碼 代碼如下:

  var LeaveFunext = function(t,f){for(var p in f){t[p]=f[p]} return t};
  var IE = '\v' == 'v';
  var contains = function(wrap,child){
  if(IE) return wrap.contains(child);
  while(child && typeof(child.parentNode) != "undefind"){
  if(wrap == child) return true;
  child = child.parentNode;
}
return false;
  };
  var LeaveFun = function(o){
  var _o = typeof o =="string" ? document.getElementById(o) : o;
  return this == window ? new LeaveFun(_o):LeaveFunext(_o, LeaveFun.prototype);
  };
  LeaveFun.prototype = {
  mouseleave : function(fn){
  if(IE){
  this.attachEvent('onmouseleave',fn);
  }else{
this.addEventListener('mouseout',function(e){
tar = e.relatedTarget;
if(!contains(this, tar)){
fn.call(this);
}
  }, false);
  }
  return this;
  }
  };
  //調(diào)用
  LeaveFun('share_customerdiv').mouseleave(function(){document.getElementById('share_customerdiv').style.display ='none';})

3、最簡(jiǎn)單,但在部分系統(tǒng)上會(huì)有輕微閃爍。
復(fù)制代碼 代碼如下:

<div style="z-index: 11; " onmouseout="this.style.display='none'" onmouseover="this.style.display='block'" >
<b class="STYLE19">更多此人的...</b>
<a class="STYLE8" >留言板</a>
<a class="STYLE8" >好友</a>
<a class="STYLE8"></a>
</div>

相關(guān)文章

最新評(píng)論

肥乡县| 祁连县| 烟台市| 沧州市| 盘锦市| 井研县| 唐海县| 浙江省| 沧源| 桂林市| 长宁县| 新乡市| 石台县| 南昌县| 三穗县| 兖州市| 邢台市| 崇义县| 丁青县| 泗阳县| 佛冈县| 深水埗区| 汝南县| 潼关县| 肇源县| 沈阳市| 青浦区| 寿宁县| 木兰县| 绩溪县| 太仆寺旗| 故城县| 石首市| 宁津县| 望谟县| 玉田县| 三穗县| 壤塘县| 体育| 丹棱县| 海南省|