这是firefox输入框bug吗? 请问如何解决?(内详)

过河石头 2007-09-22 02:32:56
---------------------------------------------------------------
将下边的内容存为一个htm文件,用FireFox打开,问题有注明
---------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FireFox的textBox模型</title>
<script src="/js0.1/$.js" language="javascript" type="text/javascript"></script>
<script>
function out()
{
for(var v = 0; v<arguments.length; v++)
{
$("outDiv").innerHTML += arguments[v]+"<br/>";
}
}
</script>
<link rel="stylesheet" type="text/css" href="../Css/common.css">
<style type="text/css">
<!--
#outDiv {
width:300px;
height:800px;
border:#666666 1px solid;
padding:4px;
z-index:1;
background-color: #E8FFF0;
float:right;
}
#Layer1 {
position:absolute;
left:8px;
top:121px;
width:358px;
height:57px;
z-index:1;
background-color: #FFFF00;
text-align:center;
font-size:14px;
font-family:Arial, Helvetica, sans-serif;
}
#Layer2 {
position:absolute;
left:222px;
top:230px;
width:87px;
height:126px;
z-index:2;
background-color: #99FFFF;
border:8px #FF3300 solid;
}
-->
</style>
</head>
<body>
<div id="Layer1" onmouseout="f1(event,this)"><br />
本div:事件源(evt.srcElement||evt.target)</div>
<div id="outDiv"></div>
<br />
在FireFox中:
<div>
<script>
function f1(_evt,This)
{
try{
var evt = _evt ? _evt : event;
var tobj = evt.toElement || evt.relatedTarget;
out("tobj="+tobj);
out("tobj.id="+tobj.id);
out("tobj.tagName="+ tobj.tagName);
out("tobj.nodeType="+ tobj.nodeType);
out("<hr/>");
}
catch(e)
{
out("<span style='color:red;'> 异常:" + e + "</span>");
}
}
</script>
<input name="txt1" type="text" id="txt1" style="width:400px; float:left; height:120px; border:#0000FF 16px solid; background-color: #CCCCCC;" value="当灰色部分作为evt.relatedTarget时,js取不到属性,引发了异常."/>
当兰色部分作为evt.relatedTarget时,正常.
</div>
</body>
</html>
...全文
219 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
过河石头 2007-10-16
  • 打赏
  • 举报
回复
多谢 yoyobp 的留言回复
过河石头 2007-10-10
  • 打赏
  • 举报
回复
up
过河石头 2007-10-08
  • 打赏
  • 举报
回复
up
过河石头 2007-09-30
  • 打赏
  • 举报
回复
大意了...
这里给个链接,可以直接看到状况:
http://web703206.goofar.net/fbug/
有好的解决方案再加分
yoyobp 2007-09-29
  • 打赏
  • 举报
回复
src="/js0.1/$.js" 这个文件呢?

而且只看到event,没有看到window.event
过河石头 2007-09-29
  • 打赏
  • 举报
回复
不能沉,请高手解困惑
过河石头 2007-09-27
  • 打赏
  • 举报
回复
自己顶
过河石头 2007-09-22
  • 打赏
  • 举报
回复
我说的是 FireFox的 <input type="text" .../> 存在的一个问题,在某种情形下触发事件时,会引发异常.

对于这种情形,你把我发的那段代码存为一个html文件,在Firefox中运行,就可以看到了
ruanchao 2007-09-22
  • 打赏
  • 举报
回复
不知道你说的什么,能不能清楚一些呢?
过河石头 2007-09-22
  • 打赏
  • 举报
回复
textarea也有这个问题

87,910

社区成员

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

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