iframe bgcolor

Hi, i am using an iframe but i am not being able to set its bgcolor other than white.. I am using the following code:

<iframe id="dsd" ALLOWTRANSPARENCY="true" bgcolor="red" src="page1.htm" width=541 height=200>
</iframe>

I dont want to modify it in the src file's body, coz it is used in another page.. Can't I set it from the parent page as listed above?
zahir79bAsked:
Who is Participating?
 
nschaferConnect With a Mentor Commented:
Hi zahir79b,

This works in IE and FF, I haven't tested with other browsers:

<iframe id="dsd" src="page1.htm" onload="window.frames[0].document.body.style.backgroundColor='red'";>
</iframe>


Hope this helps,
Neal.
0
 
callrsCommented:
<iframe id="dsd" ALLOWTRANSPARENCY="true" style="background-color: red;" src="blank2.htm" width=541 height=200>
</iframe>
0
 
zahir79bAuthor Commented:
I have tried it and its not working.. and i also tried to put the color like 'red' and still not working.. and tried to change it in javascript document.getElementById("dsd").style.backgroundColor = "red" ... nothing working .. :(
0
 
zahir79bAuthor Commented:
Thnaks its working ok ..
0
 
nschaferCommented:
Glad I could help,

Neal.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.