admin管理员组文章数量:1322027
I have a html page with an IFrame linking towards a text file, my html page's body is set to black, and the default color of the IFrame txt is black, so I cannot see my text :/ I would like to know how to change the text color, thanks. zeokila
<iframe src=".txt" width="470" frameborder="0" marginheight="0" marginwidth="0" style="overflow-x:hidden"></iframe>
I have a html page with an IFrame linking towards a text file, my html page's body is set to black, and the default color of the IFrame txt is black, so I cannot see my text :/ I would like to know how to change the text color, thanks. zeokila
<iframe src="http://wordpress/extend/plugins/about/readme.txt" width="470" frameborder="0" marginheight="0" marginwidth="0" style="overflow-x:hidden"></iframe>
Share
Improve this question
asked Apr 22, 2012 at 19:09
Alexandre HitchcoxAlexandre Hitchcox
2,7536 gold badges24 silver badges34 bronze badges
6
- possible duplicate of How to apply CSS to iFrame? – John Conde Commented Apr 22, 2012 at 19:11
-
Not a dup. This is a text file with
.txt
extension. – Teemu Commented Apr 22, 2012 at 19:20 -
try importing the file as an
object
– hjpotter92 Commented Apr 22, 2012 at 19:21 -
This might be a stupid question, but how can you set a black background for the
IFRAME
, if there is txt file loaded? By default it is white. – Teemu Commented Apr 22, 2012 at 19:34 - 2 Good question. Upvoting. And who was the joker who wants to close this as "not a real question"? – Mr Lister Commented Apr 22, 2012 at 20:26
1 Answer
Reset to default 4This makes the trick at least in FF, IE and Opera.
document.getElementById('your_iframe_id').contentWindow.document.body.style.color='white';
In Chrome you can only change IFRAME
s background color:
document.getElementById('your_iframe_id').style.background='white';
And for change background color in IE:
document.getElementById('your_iframe_id').contentWindow.document.body.style.backgroundColor='yellow';
Then there is a big but... those expressions including contentWindow
, work only, if the iframe and the host page are in the same domain.
(It is IE only having that white background by default)
本文标签: javascriptHow can I change the text color in IFrameStack Overflow
版权声明:本文标题:javascript - How can I change the text color in IFrame - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742110480a2421231.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论