首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

上句jquery 换成js 得如何写

2012-09-17 
下句jquery 换成js 得怎么写啊下句jquery 换成js 得怎么写啊$(function () {$(li:has(ul)).hover(functi

下句jquery 换成js 得怎么写啊
下句jquery 换成js 得怎么写啊  

$(function () {
  $("li:has(ul)").hover(
function () {
  $(this).children("ul").show();
},
function () {
  $(this).children("ul").hide();
})
  })

[解决办法]

JScript code
window.onload=function(){      var dom=document.getElementsByTagName("li");      for(var i=0;i<dom.length;i++){         if (dom[i].childNodes.length > 0)        {            for (var j=0,l=dom[i].childNodes.length;j<l ;j++ )            {                if (dom[i].childNodes[j].tagName == "UL")                {                    dom[i].onmouseover=function(){                         for (var i=0,l=this.childNodes.length;i<l ;i++ )                        {                            if (this.childNodes[i].tagName == "UL")                            {                                this.childNodes[i].style.display='';                            }                        }                    }                    dom[i].onmouseout=function(){                         for (var i=0,l=this.childNodes.length;i<l ;i++ )                        {                            if (this.childNodes[i].tagName == "UL")                            {                                this.childNodes[i].style.display='none';                            }                        }                    }                }                                     }        }               }    } 

热点排行