admin管理员组文章数量:1414923
I have a webpage that uses an iFrame (see .html) and (of course) the iFrame shows up with a white background in IE instead of the blue background in firefox and chrome. I have tried everything to make the background of the iframe blue/transparent include:
- adding the "allowtransparency=true" tag to the iframe
- adding a "background-color: blue" & "background-color: transparent" tag to the inside of the iframe using javascript
- enclosing the iframe in a span tag with "background-color: blue"
- changing the iframe to a div (wouldnt work because I am using AJAX to get the source from a XML file and the XMLHttpRequest object can only be used once)
If anyone knows a solution to my problem then please let me know. I should also note that the only success I had was with style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)".
Thanks!
I have a webpage that uses an iFrame (see http://little-apps/lilregcleaner/history.html) and (of course) the iFrame shows up with a white background in IE instead of the blue background in firefox and chrome. I have tried everything to make the background of the iframe blue/transparent include:
- adding the "allowtransparency=true" tag to the iframe
- adding a "background-color: blue" & "background-color: transparent" tag to the inside of the iframe using javascript
- enclosing the iframe in a span tag with "background-color: blue"
- changing the iframe to a div (wouldnt work because I am using AJAX to get the source from a XML file and the XMLHttpRequest object can only be used once)
If anyone knows a solution to my problem then please let me know. I should also note that the only success I had was with style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)".
Thanks!
Share Improve this question asked May 20, 2011 at 0:16 SameOldNickSameOldNick 2,4571 gold badge28 silver badges34 bronze badges 02 Answers
Reset to default 2Setting the IFRAME BODY's style
attribute to background-color:blue
works for me in IE8's debugger. (That is, the BODY of the document loaded in the IFRAME.)
Alternatively, you could use JavaScript to change the BODY's styles directly:
document.getElementById("versionHistory").contentWindow.document.body.style.backgroundColor="blue";
// get the IFRAME window object, get the BODY tag in that window, set its CSS
I think you have to add the background in the page loaded in the iframe.
Example, modify http:/little-apps/lilregcleaner/history/1.xx.html
本文标签: javascriptTrying to change background color of iFrame in IEStack Overflow
版权声明:本文标题:javascript - Trying to change background color of iFrame in IE - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745180330a2646435.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论