层的问题 关于 显示/隐藏
在下面的例子中,如果同时出现两个或两个以上的 A 连接,那么,当别人不去点击出现的层时,会导致几个层都不隐藏的问题,该如何解决?
**************请大家给予指点-----------
<html>
<script langugae='javascritp'>
function OverIt(obj){
eval("var mdata = document.all.div" + obj.substr(6,1) + ".style.display");
clearTimeout(mhandle);
if(mdata == "") return;
eval('document.all.div' + obj.substr(6,1) + '.style.left=window.event.x');
eval('document.all.div' + obj.substr(6,1)) ;
document.all.div2.style.display='';// (这句可以实现层的显示)
eval("document.all.div" + obj.substr(6,1) + ".style.display=''"); //(这句不可以,一样的结果)
}
var _setTimeout1 = window.setTimeout;
function _setTimeout(fRef, mDelay)
{
if(typeof fRef == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu); });
return _setTimeout1(f, mDelay);
}
return _setTimeout1(fRef,mDelay);
}
var mhandle = null;
function OutIt(obj){
clearTimeout(mhandle);
mhandle = _setTimeout(OutIt1,100,obj);
}
function OutIt1(obj){
eval("document.all.div" + obj.substr(6,1) + ".style.display='none'");
}
function show_msg(mtd)
{
alert(mtd.innerHTML);
}
</script>
<body>
<div onmousemove='OverIt("A_Link2")' onmouseout='OutIt("A_Link2")' id=div2 style='position:absolute;display:none;'>
<table border=1 cellpadding='0' cellspacing='0' width=200>
<tr><td onclick='show_msg(this)'>罗技</td></tr>
</table>
<table border=1 cellpadding='0' cellspacing='0'>
<tr><td onclick='show_msg(this)'>福晶</td></tr>
</table>
</div>
<p><p><p>
<table width=180 border=1 cellpadding=0 cellspacing=0>
<tr><td width=30 height=22><div align=center><img src=images/topBar_bg.gif width=11 height=11></div></td>
<td width=150><a href='Product.asp?BigClassName=键盘系列' id='A_Link2' onmousemove='OverIt(this.id)' onmouseout='OutIt(this.id)'>键盘系列</a></td>
</tr>
</table>
<div onmousemove='OverIt("A_Link3")' onmouseout='OutIt("A_Link3")' id=div3 style='position:absolute;display:none;'>
<table border=1 cellpadding='0' cellspacing='0' width=200>
<tr><td onclick='show_msg(this)'>罗技</td></tr>
</table>
<table border=1 cellpadding='0' cellspacing='0'>
<tr><td onclick='show_msg(this)'>福晶</td></tr>
</table>
</div>
<p><p><p>
<table width=180 border=1 cellpadding=0 cellspacing=0>
<tr><td width=30 height=22><div align=center><img src=images/topBar_bg.gif width=11 height=11></div></td>
<td width=150><a href='Product.asp?BigClassName=鼠标系列' id='A_Link3' onmousemove='OverIt(this.id)' onmouseout='OutIt(this.id)'>鼠标系列</a></td>
</tr>
</table>
</body>
</html>
**************请大家给予指点-----------
<html>
<script langugae='javascritp'>
function OverIt(obj){
eval("var mdata = document.all.div" + obj.substr(6,1) + ".style.display");
clearTimeout(mhandle);
if(mdata == "") return;
eval('document.all.div' + obj.substr(6,1) + '.style.left=window.event.x');
eval('document.all.div' + obj.substr(6,1)) ;
document.all.div2.style.display='';// (这句可以实现层的显示)
eval("document.all.div" + obj.substr(6,1) + ".style.display=''"); //(这句不可以,一样的结果)
}
var _setTimeout1 = window.setTimeout;
function _setTimeout(fRef, mDelay)
{
if(typeof fRef == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu); });
return _setTimeout1(f, mDelay);
}
return _setTimeout1(fRef,mDelay);
}
var mhandle = null;
function OutIt(obj){
clearTimeout(mhandle);
mhandle = _setTimeout(OutIt1,100,obj);
}
function OutIt1(obj){
eval("document.all.div" + obj.substr(6,1) + ".style.display='none'");
}
function show_msg(mtd)
{
alert(mtd.innerHTML);
}
</script>
<body>
<div onmousemove='OverIt("A_Link2")' onmouseout='OutIt("A_Link2")' id=div2 style='position:absolute;display:none;'>
<table border=1 cellpadding='0' cellspacing='0' width=200>
<tr><td onclick='show_msg(this)'>罗技</td></tr>
</table>
<table border=1 cellpadding='0' cellspacing='0'>
<tr><td onclick='show_msg(this)'>福晶</td></tr>
</table>
</div>
<p><p><p>
<table width=180 border=1 cellpadding=0 cellspacing=0>
<tr><td width=30 height=22><div align=center><img src=images/topBar_bg.gif width=11 height=11></div></td>
<td width=150><a href='Product.asp?BigClassName=键盘系列' id='A_Link2' onmousemove='OverIt(this.id)' onmouseout='OutIt(this.id)'>键盘系列</a></td>
</tr>
</table>
<div onmousemove='OverIt("A_Link3")' onmouseout='OutIt("A_Link3")' id=div3 style='position:absolute;display:none;'>
<table border=1 cellpadding='0' cellspacing='0' width=200>
<tr><td onclick='show_msg(this)'>罗技</td></tr>
</table>
<table border=1 cellpadding='0' cellspacing='0'>
<tr><td onclick='show_msg(this)'>福晶</td></tr>
</table>
</div>
<p><p><p>
<table width=180 border=1 cellpadding=0 cellspacing=0>
<tr><td width=30 height=22><div align=center><img src=images/topBar_bg.gif width=11 height=11></div></td>
<td width=150><a href='Product.asp?BigClassName=鼠标系列' id='A_Link3' onmousemove='OverIt(this.id)' onmouseout='OutIt(this.id)'>鼠标系列</a></td>
</tr>
</table>
</body>
</html>
...全文
相关推荐
javascript 层隐藏和显示的代码
### JavaScript 层隐藏和显示的代码详解#### 一、背景介绍在Web开发中,动态控制页面元素的显示与隐藏是一种常见的需求。
103.在 Vue 3 中使用 OpenLayers 控制图层来显示/隐藏地图
是一个强大的开源库,可以用于构建各种地理信息系统应用。在 Vue 3 中,我们可以结合。方法,可以直接控制某个图层是否可见,而不需要删除或重新创建图层。在开始之前,确保你已经搭建了 Vue 3 项目,并安装了。本文将详细介绍如何在 Vue 3 组合式 API (,并实现按钮控制地图的显示/隐藏功能。会导致 OSM 瓦片地图无法加载。方法控制地图图层的显示与隐藏。安装完成后,即可开始编写代码。在本教程中,我们介绍了如何在。来实现地图的显示/隐藏功能。来实现交互式地图,并通过。在 WebGIS 开发中,
AD中如何隐藏和显示敷铜层
如何显示盒隐藏PCB的敷铜!
jquery鼠标放上去显示悬浮层即弹出定位的div层
接下来,我们编写两个JavaScript函数:`show` 和 `hide`,它们分别用于显示和隐藏悬浮层。`show` 函数接收两个参数,一个是触发事件的对象,另一个是悬浮层的ID。
html弹出层效果
HTML负责定义页面的基本结构,包括弹出层的内容;CSS则用于样式设计,使弹出层具有美观的外观和适当的定位;JavaScript则用来控制弹出层的显示和隐藏,以及可能的交互行为。


