View Full Version : Frame background colour

11-30-2005, 08:46 PM
Hi all,

Wanting to do the crazy thing again.....

If I use the style="background-color: transparent" in the <body> tag of the html what will show through? Should it be the previous background colour of the frame? Should it be the previous contents of the frame? If neither, why would you want to specify it?

The reason I ask is that I want to dynamically change the background color of the frame, but without changing the html for each page I want to display in the frame e.g., I choose green as my default background, and whether I look at page 1 or page 2 in my frame, I see the green background. Fred on the other hand chooses purple as his default background and sees purple whether looking at page 1 or page 2. Now, I can dynamically change the background within page 1 and also within page 2 which is fine albeit complicated, but not if you have a thousand pages to change! It would therefore be so much easier to set it to 'transparent' and have the default background showing through.

Anybody any ideas as to how this might be accomplished? Please be gentle - I have grand ideas but little knowledge.....



11-30-2005, 09:03 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function changeBg(){
else if(parent.test.location=='http://www.yoursite.com/page2.html'){
else if(parent.test.location=='http://www.yoursite.com/page3.html'){

<iframe name="test" onload="changeBg()" id="test" src="page1.html"></iframe>