Board Logo

Problem buffering a color in an attribute. Please help.
Julien - 9/28/2009 at 10:51 AM

Hello,

I'm trying to pick a color, to store it in the "value" attribute or the caller (<input> element), and right after to call a function that changes either the foreground or the background color of several elements, using the value stored previously.

My code is something like :

<input id="intro_area_text_color" class="color_picker" onclick="javascript:TCP.popup(this);
var bgColor = this.value; alert(bgColor);
ChangeElementBackgroundColor(id, bgColor)" >
&nbsp;</input>

The TCSelect() function was set to :

function TCSelect(c) {
this.field.value = '#' + c.toString(); // Try to buffer the color
this.win.close();
}

Unfortunately, the message box shows that the value is not set. However, if one picks a color again, the caller <input> element then has its value set to the chosen color.

I cannot understand why the caller's "value" attribute is not set after the picker returns and why it is when one calls the picker again.

Can someone help ?
Many thanks in advance.

Julien


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/