|
Form Color Selector
v1.0 - Feb 23, 2005
formcolorselector.zip (7k)
Form Color Selector is a Dynamic HTML script
that allows users to update the value of a form field with a color value by selecting it from a color chart.
The color is selected from a popup layer that displays the 216 web-safe colors.
The Form Color Selector ensures that input data is in a valid color value format.
Features:
- Popup layer displaying the 216 web-safe colors.
- Color value displayed in Hexadecimal or RGB.
* This script requires the Dynamic HTML scripting library dynLib.
For more information about dynLib please visit the dynLib website.
Demonstration
Click the Select Color button and the Form Color Selector will popup allowing you to update the form field.
Installation
1. Upload the files dynlib.js & formcolorselector.js
then link them to your document as JavaScript include files.
Add the following code between the <head> & </head> tags:
<script language="JavaScript" src="dynlib.js"></script>
<script language="JavaScript" src="formcolorselector.js"></script>
2. Upload the image file blank.gif to your website then
set the path to this file within the configuration section of the file formcolorselector.js.
3. Call the openFormColorSelector() function.
The following example uses a form button:
<form name="demoForm">
<input name="demoInputField" type="text">
<input type="button" value="My Text"
onclick="javascript:openFormColorSelector('demoForm','demoInputField');">
</form>
Documentation
Function: formColorSelector()
Description: This function is used to open a new window containing the click-able color samples.
This function uses two arguments that define the name of the
form and its element where the color value will be sent to.
An error will be generated if either the form name or element name do not exist.
formColorSelector(FORMNAME,ELEMENTNAME)
| FORMNAME |
A string that specifies the name of the form. |
| ELEMENTNAME |
A string that specifies the name of the form element. |
Source Code
formcolorselector.js (4k)
Notes
- If you want to make sure that only color values are entered into your form field,
add some code to the input box that blocks users from typing their own values.
Form Color Selector by Lloyd Hassell
Website: lloydhassell.brinkster.net
Email: lloydhassell@hotmail.com
|