View Full Version : Require assistance to slightly modify JS
Deanna475
02-09-2003, 07:43 AM
I've got this little snippet of JS that is contained in an iframe page that changes the background colour on the parent page when you mouseover a colour cube. Now I'm trying to figure out how to change the background to a colour when a *graphic* background is showing as the current background on the parent page. If I use the script I have now, the graphic background overrides the colour cube settings and, in effect, nothing appears to happen.
This is the colour cube JS I'm using now:
<SCRIPT LANGUAGE=JavaScript>
lck=0;
function r(hval)
{
if ( lck == 0 )
{
top.document.body.bgColor=hval;
document.f.c.value=hval;
}
}
function l()
{
if (lck == 0)
{
lck = 1;
}
else
{
lck = 0;
}
}
</SCRIPT>
What do I need to change to make it so that the colour overrides any graphic background showing on the parent page?
Any and all assistance is appreciated.
Mhtml
02-09-2003, 09:48 AM
just have document.body.background = ''; before you change the bgColor.
Deanna475
02-09-2003, 10:50 AM
Fantastic. That does the trick! Many many thanks.
Mhtml
02-09-2003, 11:15 AM
No worries, glad to help. :)
Deanna475
02-09-2003, 11:27 AM
I see you're from Australia and one of the few people up at this hour of the morning -- 6:30 a.m. in Central Canada. I sure could use a reply to another question I tacked on to the bottom of an existing question in this thread:
http://www.codingforums.com/showthread.php?s=&threadid=9096
Would you mind taking a look and giving me a yes or no answer? And if the answer is yes, what line of code do I need to achieve the desired effect? I've been looking all over the web for an answer and have found nothing so far that either says "yay" or "nay". :confused:
Deanna475
02-10-2003, 12:16 PM
Hi. Me again. Now I'd like to take this colour cube JS and rather than have it change the background colour, I'd like it to change the outside table borders on my main page. I've been messing around using CSS and styles to modify the table border but obviously I don't know what I'm doing! Here's what I've been trying:
This is the CSS I'm using on the parent page:
<table cellpadding="20" cellspacing="0" bgColor="#C9BDA9" border="3" style="border:bevel; border-color:#A39379">
And here's how I've been trying to get the colour cube JS to work with the CSS (this is the latest attempt -- there have been many variations on this concept !!!):
<SCRIPT LANGUAGE=JavaScript>
lck=0;
function r(hval)
{
if ( lck == 0 )
{
top.style.border.color=hval;
document.f.c.value=hval;
}
}
function l()
{
if (lck == 0)
{
lck = 1;
}
else
{
lck = 0;
}
}
</SCRIPT>
Any and all assistance is greatly appreciated.
Deanna475
02-12-2003, 10:08 PM
Hi again. Just asking if someone could please take a look at my JavaScript situation. I can't get my head around what I'm supposed to modify in the iFrame's colour cube JavaScript to be able to change the parent content table's border. I think it's got something to do with my CSS code for the table border but I'm not sure.
If you want to see the page in action (or lack of action for this particular aspect of the site), visit:
http://www.theinspirationgallery.com/neo/neoclassic_tableborder_test.htm
Maybe a peek at my source code might reveal where I'm going wrong?
Also, how would I apply this concept of using the colour cube to change the colours of the CSS buttons on the parent page -- if it's even possible?
As always, any and all assistance is greatly appreciated. *S*
PS: Please disregard my additional question to Mhtml regarding this thread: http://www.codingforums.com/showthr...=&threadid=9096. cg9com gave me his feedback on that matter. :thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.