IE 8 iframe border

前端 未结 7 1131
半阙折子戏
半阙折子戏 2020-12-15 15:56

There is a border showing on an iframe and I can\'t get rid of it.

IE 6 and 7 work as intended with a little JavaScript:



        
7条回答
  •  不思量自难忘°
    2020-12-15 16:33

    I had the same problem with iframes created dynamically, and it turned out that setting border properties AFTER adding the iframe to the document has NO effect:

    The following code shows a 3d border:

    var iframe = document.createElement("IFRAME");
    iframe.src = "http:www.stackoverflow.com";
    //Iframe added BEFORE setting border properties.
    document.body.appendChild(iframe);
    iframe.frameBorder = "no";
    

    But this actually removes it:

    var iframe = document.createElement("IFRAME");
    iframe.src = "http:www.stackoverflow.com";
    iframe.frameBorder = "no";
    //Iframe added AFTER setting border properties.
    document.body.appendChild(iframe);
    

    Hope that this would help solve your problem.

提交回复
热议问题