window.resizeTo(240, 182); self.focus() function _CloseOnEsc() { if (event.keyCode == 27) { window.close(); return; } }
function Init() { // run on page load __dlg_init(); // document.body.onkeypress = _CloseOnEsc;
var color = window.dialogArguments; color = ValidateColor(color) || '000000'; View(color); // set default color }
function View(color) { // preview color document.getElementById("ColorPreview").style.backgroundColor = '#' + color; document.getElementById("ColorHex").value = '#' + color; }
function Set(string) { // select color var color = ValidateColor(string); if (color == null) { alert("Invalid color code: " + string); } // invalid color else { // valid color View(color); // show selected color __dlg_close(color); } }
function ValidateColor(string) { // return valid color code string = string || ''; string = string + ""; string = string.toUpperCase(); var chars = '0123456789ABCDEF'; var out = '';