...

View Full Version : Help with onLoad



EvilFlame
05-21-2005, 01:05 PM
ok i have made a webpage with color changing background as in like onClick

this is in Settingsscreen


<SCRIPT language=javascript>
function changeStyle(element,property,value,targetFrame)
{
if (!targetFrame) targetFrame = window;
targetFrame.document.getElementById(element).style[property] = value;
}

function changeText (element,value,targetFrame)
{
if (!targetFrame) targetFrame = window;
targetFrame.document.getElementById(element).innerHTML = value;
}
</script>



<SELECT style="WIDTH: 300px" id="bgcolour" onchange="javascript:changeStyle ('body', 'backgroundColor', this.value, parent.frames['Settingsscreen'])">

and this works fine on more then 1 form but the thing is once i load a new page into frame Main it sets the bgcolor bk to White so i need to know how i can us a onLoad to get it to look up the color of the background when it loads.

this is the index for the web page


<html>
<head>
<title>Accessibilty Web Page</title>
</head>
<frameset cols="300,*">
<frame src="pages/sidebar.html" name="sidebar" id="sidebar">
<frameset rows="200,*">
<frame src="pages/settingsscreen.html" name="settingsscreen" id="settingsscreen">
<frame src="pages/Main.html" name="Main" id="Main">
<frame name="Dyslexia" src="Dyslexia.html">
<noframes>
<body>
</body>
</noframes>
</frameset>
</frameset>
</html>


this is the code to put the page into the frame


<A HREF="Dyslexia.html" TARGET="Main" id="textlink">Dyslexia</A>
<br>

this is the coding for the page going in to the frame


<html>
<head>
<title>Dyslexia</title>

</head>

<body bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 id="body">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<center><p id="text">Dyslexia</p>
</Body>
</html>

glenngv
05-23-2005, 10:51 AM
Do you want the background color of the Dyslexia page to be the same as that of settingsscreen frame?

<head>
<title>Dyslexia</title>
<script type="text/javascript">
window.onload = function(){
document.getElementById('body').style.backgroundColor = parent.frames['settingsscreen'].document.getElementById('body').style.backgroundColor;
}
</script>
</head>
<body id="body">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum