如何使用javascript从IE中删除iframe边框 [英] How to remove border from iframe in IE using javascript
本文介绍了如何使用javascript从IE中删除iframe边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过javascript将iframe插入浏览器DOM,并希望删除边框,如果IE但似乎无法。我试过这些无济于事:
I am trying to insert an iframe into the browser DOM via javascript and want to remove the border if IE but can't seem to. I have tried these to no avail:
iframeElement.style.borderStyle="none";
和
iframeElement.style.frameBorder = "0";
我们非常感谢任何建议。
Any suggestions will be much appreciated.
推荐答案
奇怪的是,我今天早些时候正在寻找这个问题的答案。我发现将 frameBorder
设置为 0
属性确实有效,只要你在iframe之前执行已添加到文档中。
Bizarrely, I was looking for an answer to this very issue myself earlier today. I found that setting the frameBorder
to 0
property does work, so long as you do it before the iframe is added to the document.
var iframe = document.createElement("iframe");
iframe.frameBorder = 0;
document.body.appendChild(iframe);
这篇关于如何使用javascript从IE中删除iframe边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文