JS 鼠标经过显示二级菜单的简单示例

不错的鼠标经过显示二级菜单js特效效果,感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编来看看吧。<br><strong>经测试代码如下:</strong> 经测试代码如下:


<a href=http:// onm ouSEOver=showit(0)>学堂</a> | <a href=# onm ouSEOver=showit(1)>播放器之家</a><br>
<div id=describe style=width:600px;height:40px; margin-top:10px; onm ouSEOver=clear_delayhide() onm ouSEOut=resetit(event)></div>
<script language=JavaScript1.2>
/**
 * 鼠标经过显示二级菜单
 *
 * @param 
 * @arrange (编程之家) jb51.cc
 **/
var submenu=new Array()
submenu[0]='<b><a href=http://jb51.cc/>512pic</a> | <a href=#>播放器之家</a> | <a href=http://sc.512pic.net/>素材之家</a> | <a href=http://mingzi.512pic.net/>个性名字网</a> | <a href=http://office.512pic.net/>Office之家</a></b>'
submenu[1]='<b><a href=http://jb51.cc/>512pic</a> | <a href=http://play.512pic.net>播放器之家</a> | <a href=http://sc.512pic.net/>素材之家</a> | <a href=http://mingzi.512pic.net/>个性名字网</a></b>'
var delay_hide=500
var menuobj=document.getElementById? document.getElementById(describe) : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : 
function showit(which){
clear_delayhide()
thecontent=(which==-1)?  : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}
function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout(showit(-1),delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget,e.relatedTarget))
delayhide=setTimeout(showit(-1),delay_hide)
}
function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}
function contains_ns6(a,b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
</script>

// 来自:编程之家 jb51.cc(jb51.cc) 

相关文章

什么是深拷贝与浅拷贝?深拷贝与浅拷贝是js中处理对象或数据...
前言 今天复习了一些前端算法题,写到一两道比较有意思的题:...
最近在看回JavaScript的面试题,this 指向问题是入坑前端必须...
js如何实现弹出form提交表单?(图文+视频)
js怎么获取复选框选中的值
js如何实现倒计时跳转页面