一个层上定义了onmouseout事件,但是鼠标还没有滑出该层,该层的onmouseout事件就发生了,何故?附源码

truemichael 2000-08-16 05:11:00
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function showhide()
{
ii=window.setTimeout("hideme()",20)

}
function hideme()
{
Layer2.style.display="none"
//document.write(window.event.srcElement.tagName)
}
function showme()
{
window.clearTimeout(ii)
}
</script>
</head>

<body bgcolor="#FFFFFF">
<div id="Layer1" style="position:absolute; background-color:black;width:200px; height:115px; z-index:1; left: 15px; top: 182px" onmouseover="return showme()">
<font color=white> <p>ewayrtujhrthrweyh </p>
<p>yuhkgjh sf</p>
<p>fghkfsgh</p>
<p>gdj</p></font>
</div>

<div id="Layer2" onmouseout="return showhide();" style="position:absolute; background-color:black;width:200px; height:115px; z-index:1; left: 242px; top: 187px" >
<font color=red>2354764986-
3469-4658809</font>
</div>
</body>
</html>
...全文
169 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
SimonDW 2000-09-11
  • 打赏
  • 举报
回复
哈哈,这是必然的,IE用对象方式实现HTML中的元素,
当然单纯的文字应该不会引发ONMOUSEOUT的,但如果
用表格。。。。。
以前,我在超链接上隐、现层,结果是显出来就消掉,
哈哈,查了半天。改成在层上点一下再消除吧。
SimonDW 2000-09-08
  • 打赏
  • 举报
回复
试试改成 onmouseout ="hideme();return true;"
truemichael 2000-08-16
  • 打赏
  • 举报
回复
可以把问题简单化,代码改成如下,问题依然存在:鼠标在层中滑动时只要滑到有字的地方,该
层的onmouseout事件即发生,但这时鼠标仍然在该层内。??????
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function hideme()
{
Layer2.style.display="none"
}
</script>
</head>

<body bgcolor="#FFFFFF">
<div id="Layer2" OnMouseOut="return hideme();" style="position:absolute; background-color:black;width:200px; height:115px; z-index:1; left: 242px; top: 187px" >
<font color=red>2354764986-
3469-4658809</font>
</div>
</body>
</html>
huntout 2000-08-16
  • 打赏
  • 举报
回复
script有一些問題,另外,你的onmouseover和onmouseout是分別在2個層上的!︰)

<script language="javascript">
var ii;
function showhide()
{
ii=window.setTimeout("hideme()",20)
}
function hideme()
{
Layer2.style.display="none"
//document.write(window.event.srcElement.tagName)
}
function showme()
{
Layer2.style.display=""
window.clearTimeout(ii)
}
</script>

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧