<bdo id='6xgM2'></bdo><ul id='6xgM2'></ul>
<tfoot id='6xgM2'></tfoot>
<legend id='6xgM2'><style id='6xgM2'><dir id='6xgM2'><q id='6xgM2'></q></dir></style></legend>

    1. <small id='6xgM2'></small><noframes id='6xgM2'>

    2. <i id='6xgM2'><tr id='6xgM2'><dt id='6xgM2'><q id='6xgM2'><span id='6xgM2'><b id='6xgM2'><form id='6xgM2'><ins id='6xgM2'></ins><ul id='6xgM2'></ul><sub id='6xgM2'></sub></form><legend id='6xgM2'></legend><bdo id='6xgM2'><pre id='6xgM2'><center id='6xgM2'></center></pre></bdo></b><th id='6xgM2'></th></span></q></dt></tr></i><div id='6xgM2'><tfoot id='6xgM2'></tfoot><dl id='6xgM2'><fieldset id='6xgM2'></fieldset></dl></div>
    3. appendChild 在 IE 中无法正常工作

      时间:2023-06-14

    4. <i id='UMI1s'><tr id='UMI1s'><dt id='UMI1s'><q id='UMI1s'><span id='UMI1s'><b id='UMI1s'><form id='UMI1s'><ins id='UMI1s'></ins><ul id='UMI1s'></ul><sub id='UMI1s'></sub></form><legend id='UMI1s'></legend><bdo id='UMI1s'><pre id='UMI1s'><center id='UMI1s'></center></pre></bdo></b><th id='UMI1s'></th></span></q></dt></tr></i><div id='UMI1s'><tfoot id='UMI1s'></tfoot><dl id='UMI1s'><fieldset id='UMI1s'></fieldset></dl></div>
        <bdo id='UMI1s'></bdo><ul id='UMI1s'></ul>
          • <small id='UMI1s'></small><noframes id='UMI1s'>

              <tbody id='UMI1s'></tbody>

            1. <tfoot id='UMI1s'></tfoot><legend id='UMI1s'><style id='UMI1s'><dir id='UMI1s'><q id='UMI1s'></q></dir></style></legend>

                本文介绍了appendChild 在 IE 中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试创建一个简单的模态窗口,但 IE 不配合.当我在IE中调用这个函数时,内容出现在所有内容下的页面底部,并且没有出现覆盖图像.代码如下:

                I am trying to create a simple Modal window, but IE isn't cooperating. When I call this function in IE, the content appears at the bottom of the page under all content and the overlay image does not appear. Here's the code:

                function applyOverlay(src)
                {
                  var my_overlay = document.createElement('div');
                
                  my_overlay.setAttribute('id','myoverlay');
                  var doc_height = document.body.scrollHeight;
                  my_overlay.setAttribute('style','text-align:center; position:fixed; top:0px; left:0px; background-image:url("images/trbg.png"); width:100%; height:'+doc_height+'; z-index:999;');
                  my_overlay.innerHTML="<iframe style='background:none;' frameborder=0 height='100%' width='80%' src='"+src+"'><iframe>";
                  document.body.appendChild(my_overlay);
                }
                

                推荐答案

                这是常见的 IE 问题.这很烦人,但可以控制.

                This is common IE issue. It is irritating, but managable.

                如果 document.body.appendChild 在 body 关闭之前在 body 标签内执行,IE6 将不会加载页面.7和8会等到页面加载完毕

                If document.body.appendChild is executed within the body tag before the body is closed, IE6 will simply not load the page. 7 and 8 will wait until the page is loaded

                那么,如何解决这个问题?

                So, how to approach this issue?

                • 等到正文加载完毕,使用 body.onload.
                • 将元素附加到另一个元素而不是正文标记.

                我推荐第二个选项.将元素附加到另一个目标元素将保留预期的行为,并且不会改变您将元素添加到网站的方式.

                I recommend the second option. Appending elements to another target element will preserve the intended behavior and not change the way you add your elements to the site.

                这篇关于appendChild 在 IE 中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:jquery fancybox - 防止在fancybox之外点击关闭 下一篇:如何在 Nodejs 中使用时区偏移?

                相关文章

                <legend id='VI6iI'><style id='VI6iI'><dir id='VI6iI'><q id='VI6iI'></q></dir></style></legend>

                  <small id='VI6iI'></small><noframes id='VI6iI'>

                  1. <tfoot id='VI6iI'></tfoot>
                    <i id='VI6iI'><tr id='VI6iI'><dt id='VI6iI'><q id='VI6iI'><span id='VI6iI'><b id='VI6iI'><form id='VI6iI'><ins id='VI6iI'></ins><ul id='VI6iI'></ul><sub id='VI6iI'></sub></form><legend id='VI6iI'></legend><bdo id='VI6iI'><pre id='VI6iI'><center id='VI6iI'></center></pre></bdo></b><th id='VI6iI'></th></span></q></dt></tr></i><div id='VI6iI'><tfoot id='VI6iI'></tfoot><dl id='VI6iI'><fieldset id='VI6iI'></fieldset></dl></div>
                      <bdo id='VI6iI'></bdo><ul id='VI6iI'></ul>