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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question changing the background of frames to match the main window

    is there a way to change the background of a frame to be the same as a background in a different frame?
    Last edited by cursor_joe; 02-01-2005 at 03:05 AM.

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    normal frames:
    parent.frames['frameName'].document.bgColor='blue';

    iframes:
    iframeName.document.bgColor='blue'
    Oh, was I supposed to put something here? ........

  • #3
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i have the basic two frame layout(one on the left is the menu, and one on the right is win-main)

    can i use what you just showed me to change the background of the menu frame to be whatever the background of win-main is without knowing what the background of win-main is?

  • #4
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if anyone has a reply please feel free to AIM me or YAHOO me

  • #5
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    might there possibly be another way to do it?

    ...sorry if i seem impatient but i really would like this asap

  • #6
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    For one, don't cross post
    And how come you don't know what color the right frame is? Do you have some type of background color changer your using? You need to explain a little better, before you expect such urgent help.

  • #7
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry for my haste in my earlier posts

    ok let me try to resay this

    i have two frames(one is a menu, and one is the main window, called win-main)

    the menu can take win-main to different pages, of which i have not created the backgrounds for

    is there a way to find out what the backgrounds of these other pages are and then change the background of the menu to match?

  • #8
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    to findout:
    var whatever=parent.frames['win-main'].document.bgColor; // (background for an image)

    to change it :
    parent.frames['win-main'].document.bgColor='blue';// (background for an image)

    NOTE:
    var Q=parent.frames['win-main'].document;
    Q.bgColor=color;

    is okay, but

    var Q=parent.frames['win-main'].document.bgColor;
    Q=color;

    will just change the vars value, not the background
    Oh, was I supposed to put something here? ........

  • #9
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks

    is there a way to make the menu have the same background as 'win-main' once i find it?

  • #10
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    parent.frames['menu-frame-name'].document.bgColor=parent.frames['win-main'].document.bgColor;
    parent.frames['menu-frame-name'].document.background=parent.frames['win-main'].document.background;
    Oh, was I supposed to put something here? ........

  • #11
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i've tried putting it in all 3 pages now(the page with the frames, the menu frame, and the 'win-main' frame) and i cannot figure out where to place it so that when the 'win-main' page changes it will run the function again

    any ideas anyone?

  • #12
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    don't forget to change "menu-frame-name" to the menus frame name and you want to put an "onclick" event handler calling the function
    Code:
    {
    parent.frames['menu-frame-name'].onload=NAME_OF_BG_CHANGER-FUNC
    
    
    }
    in any link changing the menus location
    Oh, was I supposed to put something here? ........

  • #13
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ...apparently i know less than i thought about javascript
    Code:
    <frameset cols="32%,68%" border=0>
    <frame src="idea1.html" name="menu" noresize>
     <frame src="home.html" scrolling="yes" NAME="win-main">
    </frameset>
    <body onload="x()">
    <script language="Javascript">
    function x()
    {
    parent.frames['menu'].onload=change()
    }
    
    
    function change()
    {
    parent.frames['menu'].document.background=parent.frames['win-main'].document.background;
    }
    </script>
    this is what i have in my page that holds the frames... can somebody tell me what's wrong and how to fix it please

  • #14
    New Coder
    Join Date
    Dec 2004
    Location
    Crown Point, IN
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts
    does anybody have any ideas?

  • #15
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by cursor_joe
    does anybody have any ideas?
    Quote Originally Posted by cursor_joe
    ...apparently i know less than i thought about javascript
    Code:
    <frameset cols="32%,68%" border=0>
    <frame src="idea1.html" name="menu" noresize>
     <frame src="home.html" scrolling="yes" NAME="win-main">
    </frameset>
    <body onload="x()">
    <script language="Javascript">
    function x()
    {
    parent.frames['menu'].onload=change()
    }
    
    
    function change()
    {
    parent.frames['menu'].document.background=parent.frames['win-main'].document.background;
    }
    </script>
    this is what i have in my page that holds the frames... can somebody tell me what's wrong and how to fix it please
    I have already answered this somewhere else on another forum where you had cross-posted this question and told you that a frameset does not have a body tag...

    I could probably get this working for you but I refuse to involve myself in something that has been posted in multiple forums... Besides, even if you paid me I would need to know what sites you are trying to load in your frame... Obviously they are not yours or you would know the background... additionally, I would need to know why you need your site to match the background of the site you have trapped in your frame... Sounds all rather nefarious to me...

    .....Willy


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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