|
Rank: Newbie Groups: Member
Joined: 8/25/2008 Posts: 4
|
I am trying to clear the color from a color picker using javascript, but am not having any luck. I resorted to hard coding the colorpicker name:
function ClearBGColor(chk) { if (chk.checked) { var ctl = document.getElementById('ctl00_contentRight_DisplayText1_txtdataInfo_pickBackgroundColor'); ctl.clear(); } }
But I get an 'Object dosen't support this method' when it calls the clear function. How do I call colorpicker methods in javascript from a javascript function not associated with the colorpicker?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
You certainly do not want to use getElementById. You will need to use eo_GetObject to return the ColorPicker object. Once you have the client side ColorPicker object, you can call clear method on it. So for you code, you'd basically replace "document.getElementById" with "eo_GetObject".
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/25/2008 Posts: 4
|
Thank you, but now how do I get the textbox background to clear out as well? I tried both clear and setValue, but the textbox area still stays the same color. I put in an alert at the bottom of my routine and getValue returns blank, so I now the value is set correctly. I need to set the popup selected box to clear also, so if the user opens the popup it is clear. Basically I need everything to display based on the value I set the colorpicker to in javascript. I'll be doing the same thing with White and Black to give the use a quick way to choose between White, Black or Transparent.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, The textbox is a regular input element and is not part of the ColorPicker. So I think you can do:
Code: JavaScript
document.getElementById("your_textbox_id").style.backgroundColor = "";
Thanks
|
|