代码不能在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=gb2312 " />
<title> 无标题文档 </title>
<script type= "text/javascript " language= "javascript ">
function show(evt){
document.getElementById( "ui ").style.top=evt.offsetY ;
document.getElementById( "ui ").style.left=evt.offsetX;
document.getElementById( "ui ").style.display= " ";
}
</script>
</head>
<body>
<div id= "ui " style= "background:#FF3300; position:absolute; height:100px; width:100px; display:none; "> </div>
<p> <span onclick= "show(event) "> 1111111111 </span> <br />
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> <span onclick= "show(event) "> 1111111111 </span> <br />
</p>
</body>
</html>
上面代码可以在IE中正常运行.但在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=gb2312 " />
<title> 无标题文档 </title>
<script type= "text/javascript " language= "javascript ">
function show(evt){
document.getElementById( "ui ").style.top=evt.offsetY || evt.layerY + "px ";
document.getElementById( "ui ").style.left=evt.offsetX || evt.layerX + "px ";
document.getElementById( "ui ").style.display= " ";
}
</script>
</head>
<body>
<div id= "ui " style= "background:#FF3300; position:absolute; height:100px; width:100px; display:none; "> </div>
<p> <span onclick= "show(event) "> 1111111111 </span> <br />
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> <span onclick= "show(event) "> 1111111111 </span> <br />
</p>
</body>
</html>
------解决方案--------------------试试将 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 改为
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >