这是firefox输入框bug吗? 请问如何解决?(内详)
---------------------------
将下边的内容存为一个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>
------解决方案--------------------src="/js0.1/$.js" 这个文件呢?
而且只看到event,没有看到window.event