...

View Full Version : changing the background of frames to match the main window



cursor_joe
02-01-2005, 02:47 AM
is there a way to change the background of a frame to be the same as a background in a different frame?

Bobo
02-01-2005, 02:52 AM
normal frames:
parent.frames['frameName'].document.bgColor='blue';

iframes:
iframeName.document.bgColor='blue'

cursor_joe
02-01-2005, 02:56 AM
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?

cursor_joe
02-01-2005, 03:26 AM
if anyone has a reply please feel free to AIM me or YAHOO me

cursor_joe
02-01-2005, 04:37 AM
might there possibly be another way to do it?

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

Brandoe85
02-01-2005, 07:11 AM
For one, don't cross post (http://www.codingforums.com/showthread.php?t=51372)
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.

cursor_joe
02-01-2005, 05:18 PM
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?

Bobo
02-01-2005, 06:05 PM
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

cursor_joe
02-02-2005, 02:02 AM
thanks :)

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

Bobo
02-03-2005, 06:17 PM
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;

cursor_joe
02-04-2005, 06:15 AM
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?:)

Bobo
02-05-2005, 03:34 AM
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

{
parent.frames['menu-frame-name'].onload=NAME_OF_BG_CHANGER-FUNC


}in any link changing the menus location

cursor_joe
02-05-2005, 06:17 AM
...apparently i know less than i thought about javascript


<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:)

cursor_joe
02-06-2005, 06:29 PM
does anybody have any ideas?

Willy Duitt
02-06-2005, 06:41 PM
does anybody have any ideas?



...apparently i know less than i thought about javascript


<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

cursor_joe
02-06-2005, 07:31 PM
i am helping my teacher make a webpage for the indiana foreign language teachers' association if you must know... and he has some pages already made
http://www.iflta.org

that's the site with my current design if you want to see it

Willy Duitt
02-06-2005, 07:48 PM
if you must know...

I don't need, must or otherwise, to know anything...
It is you that is asking for help and if someone whom is considering helping you has a few questions which they need answered to insure that everything is on the up and up and that their help is not being used for nefarious purposes... It is you who must appease their concerns... But as I previously stated, I'm not getting involved but if you leave the link up someone else may be willing to take a look...

Have a nice day;
.....Willy

cursor_joe
02-06-2005, 09:45 PM
my appologies willy

cursor_joe
02-07-2005, 05:13 PM
if anybody else can help me at all it would be much appreciated:D

cursor_joe
02-08-2005, 03:23 AM
this is the code of my frames page



<script type='text/javascript' src='source.js'></script>
<frameset cols="32%,68%" border=0>
<frame src="idea1.html" name="menu" id="menu" noresize>
<frame src="home.html" scrolling="yes" NAME="win-main" id="win-main">
</frameset>

<script language="Javascript">

parent.frames['win-main'].onload=change;

</script>

and this is the code of the 'source.js'



function change()
{
parent.frames['menu'].document.background=parent.frames['win-main'].document.background;
}

can somebody please tell me what's wrong with my code?:)

nnjjll
02-08-2005, 06:41 PM
Hey Joe, Listen. I have no idea how to take care of your problem, I can only suggest searching for different forums on Google and Yahoo! . I doubt anyone will help now.Willy seemS to make it his LITTLE mission in life to put people off of helping others (the point of this forum I might add). He did it to me too. So to all who wish to help, PLEASE DO SO. This guy has done nothing wrong. Oh and willy, just by the way. If my security solution was so illegal, then why was it not closed? :eek:
- Keeping an eye on you
nnjjll

cursor_joe
02-09-2005, 04:21 AM
thanks nnjjll

if anyone at all has any suggestions it would be much appreciated



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum