Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Set the bgcolor attribute value


penders - 1:25 pm on Jul 24, 2011 (gmt 0)


To see what I mean please try adding bgcolor="#00FF00" to the embed code and compare it with changing the style background color.


Indeed, the bgcolor (even the default) appears to be overwriting the style.backgroundColor - which still seems to be present, but is behind the embed bgcolor?

Setting bgcolor="transparent" in the HTML shows the style.backgroundColor, but a darker shade - I suspect 'transparent' is not completely transparent, or may be that wmode attribute is required as well?!

However, looking at your code, if you also set wmode="transparent" then this appears to work OK (you don't need to set bgcolor at all) - You can then set the backgroundColor in the CSS...

<embed id="foo" wmode="transparent" src="http://www.w3schools.com/media/bookmark.swf" 
width="400" height="40" type="application/x-shockwave-flash"></embed>


<script> 
document.getElementById("foo").style.backgroundColor = '#0f0';
</script>


The code you have above doesn't work because where you are trying to output x and y you are not in a script section!


Thread source:: http://www.webmasterworld.com/javascript/4342720.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com