Color chooser in JavaScript : Color Chooser « GUI Components « JavaScript DHTML






Color chooser in JavaScript

 


<HTML>
<HEAD>
<TITLE>Welcome</TITLE>
</HEAD>

<body>
<CENTER><h1>Color chooser</h1>
<FORM name=colc>
<table border="1">
<td colspan=2>
<SCRIPT LANGUAGE="JavaScript">
function color() {
    document.bgColor=(""+ colc.cc.value +"");
    document.body.text=(""+ colc.tc.value +"");   
}
</SCRIPT>
<B><center>Please Choose a Color</td><tr><td>
<b>Background:</td><td><select name="cc" size="1">  
    <option value="black">Black
  <option value="blue">Blue
  <option value="green">Green
  <option value="skyblue">Light Blue
  <option value="orange">Orange
  <option value="purple">Purple
  <option value="red">Red
    <option value="silver">Silver
  <option value="Yellow">Yellow  
  <option selected value="white">White
     </select></td><tr><td>
<b>Text:</td><td>
    <select name="tc" size="1">  
    <option selected value="black">Black
     <option value="blue">Blue
  <option value="green">Green
  <option value="skyblue">Light Blue
  <option value="orange">Orange
  <option value="purple">Purple
  <option value="red">Red
    <option value="silver">Silver
  <option value="Yellow">Yellow
  <option value="white">White
  </select>
</td><tr><td colspan=2>
<center><input type="button" name="button" value="Change Color!" onClick="color()">
</td>
</table>
</FORM>
</CENTER>
<p><center><h5>
By Greg Marut<br>

</h5>
</body>
</HTML>
           
         
  








Related examples in the same category

1.JavaScript ColorPicker
2.Text foreground and background color picker
3.Color Picker (Windows style)
4.Color picker (IE only)
5.DHTML Color Picker
6.Farbtastic: jQuery color picker plug-in