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

前端之家收集整理的这篇文章主要介绍了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 (512.笔记) 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) 
原文链接:https://www.f2er.com/js/527772.html

猜你在找的JavaScript相关文章