Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript event handlers

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
<HTML>

<HEAD>
<TITLE>A Simple Color Picker</TITLE>
<SCRIPT language=&quot;JavaScript&quot;>
<!--Hide from older browsers

//Stop hiding--->


browserName=navigator.appName;
if(browserName==&quot;Netscape&quot;) {

alert(&quot;Netscape users can change only the background color&quot;);
}



function ApplyColor() {


var BCR = (document.CP.BackRed.VALUE);
var BCG = (document.CP.BackGreen.VALUE);
var BCB = (document.CP.BackBlue.VALUE);
var TCR = (document.CP.TextRed.VALUE);
var TCG = (document.CP.TextGreen.VALUE);
var TCB = (document.CP.TextBlue.VALUE);
var BackColor= &quot;#&quot; + BCR + BCG + BCB;
var TextColor= &quot;#&quot; + TCR + TCG + TCB;
document.bgColor = &quot;BackColor&quot;;
document.fgColor = &quot;TextColor&quot;;
}


</SCRIPT>

</HEAD>

<BODY onLoad=&quot;test_browser&quot;(); onLoad=&quot;StartForm&quot;();>
<H1 ALIGN=CENTER>A Simple Color Picker</H1>
<FORM NAME=CP>
<TABLE BORDER CELLPADDING=5>
<TR>
<TD WIDTH=320 VALIGN=TOP>
<TABLE>
<TR>
<TD COLSPAN=3>Background (enter values from '00' to 'FF')</TD>
</TR>
<TR>
<TD>RED: <INPUT NAME=BackRed VALUE=&quot;FF&quot; SIZE=2</TD>
<TD>GREEN: <INPUT NAME=BackGreen VALUE=&quot;FF&quot; SIZE=2 ></TD>
<TD>BLUE: <INPUT NAME=BackBlue VALUE=&quot;FF&quot; SIZE=2></TD>
</TR>
<TR>
<TD COLSPAN=3>Text (enter values from '00' to 'FF')</TD>
</TR>
<TR>
<TD>RED: <INPUT NAME=TextRed VALUE=&quot;00&quot; SIZE=2></TD>
<TD>GREEN: <INPUT NAME=TextGreen VALUE=&quot;00&quot; SIZE=2></TD>
<TD>BLUE: <INPUT NAME=TextBlue VALUE=&quot;00&quot; SIZE=2></TD>
</TR>
<TR>
<TD COLSPAN=3 ALIGN=CENTER>
<INPUT TYPE=BUTTON VALUE=&quot;Apply&quot; onClick=&quot;ApplyColor();&quot;>&nbsp;&nbsp;
<INPUT TYPE=BUTTON VALUE=&quot;Reload&quot; onClick=&quot;location.reload();&quot;>
</TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=300 VALIGN=TOP>
<B>HAMLET:</B>
<P>Speak the speech, I pray you, as I pronounced it to you, trippingly on
the tongue: but if you mouth it, as many of your players do, I had as lief
the town-crier spoke my lines. </P>
</TD>
</TR>
</TABLE>
</FORM>
<SUP>*</SUP>If you are using Netscape, you won't be able to change the
text color.
</BODY>
</HTML>



Here is my code i am suppose to be able to change background and textcolors can change the colors once. can anyone help
 
is this all of your code? you seem to be missing functions that are being called.
 
i was i was missing the test browser funtion and i was not suppose to have quotes around BackColor and TextColor after taking care of those my program works. Thank you for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top