Reputation: 2753
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.org/extend/plugins/about/readme.txt" width="470" frameborder="0" marginheight="0" marginwidth="0" style="overflow-x:hidden"></iframe>
Upvotes: 6
Views: 16396
Reputation: 23406
This 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)
Upvotes: 4