+ -
当前位置:首页 → 问答吧 → javascript绝对定位在firefox3无效?

javascript绝对定位在firefox3无效?

时间:2009-06-07

来源:互联网

<!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 runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
    window.onload=function(){
    var maskObj = document.createElement("div");
  maskObj.style.position = "absolute";
  maskObj.style.top = "220"; //javascript绝对定位在firefox3无效?
  maskObj.style.left = "200";
  maskObj.style.background = "#777";
  maskObj.style.filter = "Alpha(opacity=30);";
  maskObj.style.opacity = "0.3";
  maskObj.style.width = "1000px";
  maskObj.style.height = "1000px";
  maskObj.style.zIndex = "100";
  document.body.appendChild(maskObj);
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>

作者: seekarmor   发布时间: 2009-06-07

要加单位,IE是不符合标准的

maskObj.style.top = "220px";

作者: keakon   发布时间: 2009-06-07

谢谢了楼上的兄弟!!!!

作者: seekarmor   发布时间: 2009-06-07

jQuery里对POSITION在IE和FF里的代码也是不一样的

IE: position-x | postion-y
FF: position

作者: yorsal   发布时间: 2009-06-07

相关阅读 更多