Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting background color for frame or browser?

    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

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    maybe

    CSS Code
    Code:
    frameset
    {
    background-color:black;
    }
    I don't know if that will help, but its worth a shot unless you know otherwise

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    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!
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #5
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    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/lib...ffice.10).aspx

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

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #7
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #8
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Also found this information about a Frame property "Allowtransparency" at this site: http://msdn.microsoft.com/workshop/a...ansparency.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...

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    allowtransparency is proprietary and is not valid code however if you don't care then
    Code:
    <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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    New Coder
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #11
    New Coder
    Join Date
    Nov 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question What about this case ?

    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.
    Attached Files Attached Files

  • #12
    New Coder
    Join Date
    Nov 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ChanLFC View Post
    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?

  • #13
    New Coder
    Join Date
    Nov 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ChanLFC View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •