javascript Dialog Helper ChooseColorDlg( )
ChooseColorDlg( ) | Firefox/Netscape/NN n/a IE 6 Chrome/Safari/DOM n/a |
ChooseColorDlg([initialHexColor]) | |
Displays a color selector dialog box, and returns a decimal number corresponding to the color chosen by the user. To apply the color to style or other color property settings, you may have to convert the decimal value to a suitable hexadecimal triplet value of the #RRGGBB format. The following fragment demonstrates the sequence of obtaining the color, converting it to the desired base and digit count, and assigning the value to a style property: var colorChoice = dlgHelper.ChooseColorDlg( ); var hexColor = colorChoice.toString(16); while (hexColor.length< 6) {hexColor = "0" + hexColor;} document.body.style.color = "#" + hexColor; |
|
If the user selects a custom color in the dialog and adds it to a little shortcut box, the color does not reappear in the box the next time the dialog appears. But a custom color can still be pre-selected by passing its hex value as a parameter to the method. |
|
Parameters | |
|
|
Returned Value | |
Decimal integer of the selected color (0 through as many colors of the client settings). |
Powered by Linode.