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 2 of 2
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Help with onLoad

    ok i have made a webpage with color changing background as in like onClick

    this is in Settingsscreen

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

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

    Code:
    <A HREF="Dyslexia.html" TARGET="Main" id="textlink">Dyslexia</A>
    <br>
    this is the coding for the page going in to the frame

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

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Do you want the background color of the Dyslexia page to be the same as that of settingsscreen frame?
    Code:
    <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">


  •  

    Posting Permissions

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