Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 可能是IE z索引错误?_Css_Internet Explorer_Javascript - Fatal编程技术网

Css 可能是IE z索引错误?

Css 可能是IE z索引错误?,css,internet-explorer,javascript,Css,Internet Explorer,Javascript,下面是我的代码 当在ie浏览器中打开页面,然后选择div中的文本时,文本将显示为阴影四元空白。如果删除一行 z指数:0, 在css类test1中,ie将正确执行 在我的项目中,z索引必须设置为大于零,因此我无法删除该行 我发现一个解决方案是设置bg_img.filter=当pannel.z-index大于0时,ie也会正常工作。但不幸的是,bg_img.filter.alpha也必须设置 那我该怎么办呢 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0

下面是我的代码

当在ie浏览器中打开页面,然后选择div中的文本时,文本将显示为阴影四元空白。如果删除一行 z指数:0, 在css类test1中,ie将正确执行

在我的项目中,z索引必须设置为大于零,因此我无法删除该行

我发现一个解决方案是设置bg_img.filter=当pannel.z-index大于0时,ie也会正常工作。但不幸的是,bg_img.filter.alpha也必须设置

那我该怎么办呢

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" src="scripts/im_test.js"></script>
    <title>test</title>
    <style type="text/css">
      .test1 {
        position:absolute;
        background:#ffffff;
        left:20px;
        top:20px;
        border:1px solid;
        width:198px;
        height:500px;
        filter: progid:DXImageTransform.Microsoft.Shadow(color="#999999", Direction=135, Strength=5);
        z-index:0;
      }
    </style>
    <script>

    function init ()
    {
      var pannel = document.createElement ('div');
      var bg_img = document.createElement ('div');
      var head = document.createElement ('div');

      pannel.setAttribute('class', 'test1');
      pannel.setAttribute('className', 'test1');

      bg_img.style.cssText = "position:relative;left:0px;top:0px;"
      + "width:198px;"
      + "height:500px;"
      + "filter:alpha(opacity=100);";

      head.style.cssText = "position:absolute;"
      + "left:0px;"
      + "top:0px;"
      + "width:180px;"
      + "height:20px;";

      document.body.appendChild (pannel);
      pannel.appendChild(bg_img);
      pannel.appendChild(head);

      head.innerHTML = "<div>yusutechasdf</div><div>innerhtml</div>"
    }
    </script>
  </head>
  <body onload="init()">
  </body>
</html>
IE存在z索引问题:0;尝试将其设置为一,并相应地调整其他z索引