...

View Full Version : Setting background color for frame or browser?



sigmundsquirrel
12-27-2006, 11:14 PM
I've got a frameset and I'm loading different pages into the bottom frame. The whole site has a black background, and the problem is that when a new page loads in the lower frame, the whole frame flashes white until the content loads. (Doesn't do it in Firefox on Mac, but definitely Safari, and IE)

You can see how it looks at:
http://www.poddesign.com/myvu2
-- just navigate with the menu along the top and you'll see the bottom half flash white before each section loads ("buzz" "company" etc.)

Is there a way (by CSS or Javascript) to set the background color of the browser or of the frame to black?

I tried using an inline style in the frame tag of my index page:

<frame style="background: #000000" id="changethis" name="content" src="home.html" marginheight="0" marginwidth="0" frameborder="0" border="0" noresize="yes" />

but didn't work. Any help out there?

thanks,
sigmundsquirrel

whizard
12-27-2006, 11:18 PM
maybe

CSS Code


frameset
{
background-color:black;
}


I don't know if that will help, but its worth a shot unless you know otherwise

Dan

sigmundsquirrel
12-27-2006, 11:57 PM
Thanks whizard, I gave it a try but no luck. I was checking the W3C standards, and I don't think the frameset tag can take a style, which is why I tried the frame tag. Anyone else know?

I wonder is there any way to access the browser properties? I'm thinking like: window.style.background-color?

Troy297
12-28-2006, 12:23 AM
Well - the problem in itself is simple enough isn't it? You are reloading an entire page, and so, until it loads the next file with the background attribute it will show as white.....

The only real way to avoid this would be to try and either compress your flash menu file, or use iframes and have the flash menu simply change the iframe rather than the entire page!

Hope This Helps!

sigmundsquirrel
12-28-2006, 06:05 AM
That's true, scriptz. But since the frameset itself is always loaded in the browser, I was hoping there was some way to set either the background of the entire frameset, or the background of that frame space (regardless of it's HTML content), or accessing the browser's default background color from the frameset.

Since the entire site is already structured, I'd rather not pull it apart to set it up as iframes. (And are iframes cross-browser?) Maybe this will be my fall-back strategy...

whizard
12-28-2006, 06:09 AM
I'm not sure if I understood you correctly, or if this will help, but I'm taking another stab at this anyhow..

http://msdn2.microsoft.com/en-us/library/aa263755(office.10).aspx

Scroll down a bit (to "Creating a Frames Page and Its Content from Scratch")

HTH
Dan

sigmundsquirrel
12-28-2006, 06:43 AM
Thanks again, whizard. That's an interesting page -- I'll investigate it further, but it looks like it's dynamically generating the frameset from a server? Also, probably way beyond my technical knowledge.

Actually, I found something very similar to what you posted earlier:

http://home.cogeco.ca/~ve3ll/htmlfram.htm

This page about creating frames shows this code:

-------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>A FrameSet Site</title>
<style type="text/css">frameset, p {background:white}</style>
</head>
<frameset cols="25%,75%">
<frame src="sidebar.htm" name="menu" noresize="noresize"
scrolling="auto">
<frame src="main.htm" name="text" noresize="noresize"
scrolling="auto">
<noframes>Your browser doesn't support frames!
Use the <a href="noframe.htm">No Frames Version</a>
</noframes></frameset></html>

---------------------

Notice this line:

<style type="text/css">frameset, p {background:white}</style>

which implies that you can set the background color of the frameset. Of course I tried it and it didn't work (but only checked in Safari -- I'm going to do a cross-browser/cross-platform check next...).

Anyone else familiar with this?

sigmundsquirrel
12-28-2006, 10:28 AM
Also found this information about a Frame property "Allowtransparency" at this site: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/allowtransparency.asp (for Frames and iFrames)

with this bit:

"Allowtransparency"

Description:
This attribute controls the background transparency of the FRAME element. If this attribute is false, the background color of the FRAME may only be that of the window. If the attribute is true, the background color of the FRAME may be set to any value, including transparent.
Values:
False (DEFAULT)- FRAME is opaque and can not be made transparent.
True - FRAME may be any color, including transparent.

Has anyone used this or can give some help?

Also found this definiton of Frame properties:


<frame
class="class name(s)"
frameborder="0 | 1"
id="unique alphanumeric identifier"
longdesc="url of description"
marginheight="pixels"
marginwidth="pixels"
name="frame name"
noresize="noresize"
scrolling="auto | no | yes"
src="url" of frame contents
style="style information"
title="advisory text"
>

which means a frame can have a class or style information, so why can't I apply a style="background-color:black" to it?

Just wondering...

_Aerospace_Eng_
12-28-2006, 10:36 AM
allowtransparency is proprietary and is not valid code however if you don't care then

<frame style="background:#000" src="test2.html" name="content" allowtransparency="true">

will work.

Also please in the future don't cross post. Thats against the forum rules which you probably didn't even bother to read. I suggest you read them before you post again.

sigmundsquirrel
12-28-2006, 10:58 AM
Thanks _Aerospace_Eng_, you're up late!

I was concerned about the cross-post, which is why I began my Javascript post with a mention of it. But since the two forums are for CSS and the other for Javascript, I thought I would be tapping into two different knowledge sets. Sorry for breaking the rules.

As to the background-color issue -- I'm currently using the "allowTransparency=true" and style="background:black" within the frame tag of the frameset and it is working in both IE and Firefox, which were my target browsers. Still flashing white between page loads in Safari, but I can live with that.

If anyone has a more comprehensive solution, please post -- otherwise, thanks for everyone's help!

ChanLFC
01-09-2007, 11:20 AM
Hi, I cannot put the background color property in the iframe tag itself. I have to set it dynamically depending on some values.

Consider the following case,test2.htm is embedding test3.htm inside iframe. (please refer attachment)

I am not able to change the background color of iframe in this case. Tried in IE.

Please help.

ChanLFC
01-10-2007, 08:47 AM
Hi, I cannot put the background color property in the iframe tag itself. I have to set it dynamically depending on some values.

Consider the following case,test2.htm is embedding test3.htm inside iframe. (please refer attachment)

I am not able to change the background color of iframe in this case. Tried in IE.

Please help.

Hello, got any idea about the above question posted by me?

ChanLFC
01-11-2007, 06:41 AM
Hello, got any idea about the above question posted by me?


^^^.
Come'on Man. Theres got to be someone on this forum who knows answer to my question in the post#11. I hope there is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum