Previous Example-|-Next Example-|-Return to Chapter Listing

Example 17.10:
The Color Chart

We created this Color Chart using a similar system to that shown in Example 17.9. You can see the actual script used at the bottom of this page.

Click on a color to change the background. Note that most colors will look different in VGA (16 colors) from the way they'll look in 256-color mode (or greater), so you may want to pick colors to suit VGA. What may look nice in 256-colors may look murky in VGA.


These are the scripts we used. First, in the HEAD: <script language="JAVASCRIPT"> <!-- function PickColor(form) { var sWhichSelect = form.select1.selectedIndex var sThisColor = form.select1.options[sWhichSelect].text form.select1.blur() document.bgColor = sThisColor } //--> </script> Later in the Web page the function is called from this form: <form> <select name="select1" size="15" onchange="PickColor(this.form)"> <option>aliceblue <option>antiquewhite <option>aqua <option>aquamarine <option>azure <option>beige <option>bisque <option>black <option>blanchedalmond <option>blueviolet <option>brown <option>burlywood <option>cadetblue <option>chartreuse <option>chocolate <option>coral <option>cornflowerblue <option>cornsilk <option>crimson <option>cyan <option>darkblue <option>darkcyan <option>darkgoldenrod <option>darkgray <option>darkgreen <option>darkkhaki <option>darkmagenta <option>darkolivegreen <option>darkorange <option>darkorchid <option>darkred <option>darksalmon <option>darkseagreen <option>darkslateblue <option>darkslategray <option>darkturquoise <option>darkviolet <option>deeppink <option>deepskyblue <option>dimgray <option>dodgerblue <option>firebrick <option>floralwhite <option>forestgreen <option>fuchsia <option>gainsboro <option>ghostwhite <option>gold <option>goldenrod <option>gray <option>green <option>greenyellow <option>honeydew <option>hotpink <option>indianred <option>indigo <option>ivory <option>khaki <option>lavender <option>lavenderblush <option>lawngreen <option>lemonchiffon <option>lightblue <option>lightcoral <option>lightcyan <option>lightgoldenrodyellow <option>lightgreen <option>lightgrey <option>lightpink <option>lightsalmon <option>lightseagreen <option>lightskyblue <option>lightslategray <option>lightsteelblue <option>lightyellow <option>lime <option>limegreen <option>linen <option>magenta <option>mediumaquamarine <option>mediumblue <option>mediumorchid <option>mediumpurple <option>mediumseagreen <option>mediumslateblue <option>mediumspringgreen <option>mediumturquoise <option>mediumvioletred <option>midnightblue <option>mintcream <option>mistyrose <option>moccasin <option>navajowhite <option>navy <option>oldlace <option>olive <option>olivedrab <option>orange <option>orangered <option>orchid <option>palegoldenrod <option>palegreen <option>paleturquoise <option>palevioletred <option>papayawhip <option>peachpuff <option>peru <option>pink <option>plum <option>powderblue <option>purple <option>red <option>rosybrown <option>royalblue <option>saddlebrown <option>salmon <option>sandybrown <option>seagreen <option>seashell <option>sienna <option>silver <option>skyblue <option>slateblue <option>slategray <option>snow <option>springgreen <option>steelblue <option>tan <option>teal <option>thistle <option>tomato <option>turquoise <option>violet <option>wheat <option>white <option>whitesmoke <option>yellow <option>yellowgreen </select> </form>
Previous Example-|-Next Example-|-Return to Chapter Listing