从下面的这个例子中(可下载)可以了解到如何用onmouseover 显示指定div(html标签) ,用onmouseout来隐藏指定div;此例的好处在于onmouse事件过程中不会有闪烁问题。
以下代码实例中选取,是精华所在,可更快的掌握onmouseover/out 及js相关用法
<script type="text/javascript">
var aa;
function over1(){
document.getElementById("tab1").style.display = "block";clearTimeout(aa);
}
function out1(){
aa = setTimeout(hide,100);
}
function hide(){
document.getElementById("tab1").style.display = "none"
}
</script>
</head>
<body>
<div id="d_category" onmousemove="over1();" onmouseout="out1();"><a href="javascript:void(0);">总共20类商品</a></div>
<table id="tab1" onmousemove="over1();" onmouseout="out1();" style="position:absolute;width:500px;background-color:#ddeeff;left:190px;top:74px;display:none;z-index:10;">
源:http://bbs.blueidea.com/thread-2892454-1-1.html(收藏下)