Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Browsers / Internet Explorer / April 2004



Tip: Looking for answers? Try searching our database.

changingpage background color problem in javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
poget - 23 Apr 2004 12:34 GMT
What I am trying to do is to change dynamically, the Background color of a
page by selecting a value in a set of options.
Ultimately the idea is to write that value to the registry, but first I want
to be able to dynamically change either the page BG color or the background
of the span ID="HexColorValue".
Below is what I cam up with and neddless to say does not work.
TIA
Philippe
<FORM NAME="frmMain" method="post">
    <span ID="HexColorValue">Page Background Color:</span><br>
      <SELECT ID="oHexColorValue" SIZE="1"
onchange="Javascript:fnChangeBackGroundColor(this.options[this.selectedIndex
].value)">
         <OPTION VALUE="255,0,0">Red
         <OPTION VALUE="0,255,0">Green
         <OPTION VALUE="0,0,255">Blue
         <OPTION VALUE="None" SELECTED>None
        </SELECT>
        <INPUT TYPE="button" Name="btCreatePalette" Value="Change It"
onClick="ChangePageBackGroundColor(HexColorValue_value)"></INPUT>
       </FORM>
function fnChangeBackGroundColor(color)
{
alert(color);
document.all.HexColorValue.style.backgroundColor=document.all.oHexColorValue
.options[oHexColorValue.selectedIndex].value;
}
Brian Staff - 23 Apr 2004 18:04 GMT
Phillipe,

change your options to this:

         <OPTION VALUE="#ff0000">Red

and your jscript to this:


document.all.HexColorValue.style.backgroundColor=document.all.oHexColorValue.op
tions[frmMain.oHexColorValue.selectedIndex].value;

Brian
poget - 26 Apr 2004 11:06 GMT
Thanks a lot Brian

Phil
> Phillipe,
>
[quoted text clipped - 3 lines]
>
> and your jscript to this:

document.all.HexColorValue.style.backgroundColor=document.all.oHexColorValue
.op
> tions[frmMain.oHexColorValue.selectedIndex].value;
>
> Brian
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.