我有这段代码:
<div class="entryrow">
<div class="input" style="width: 40%;">
<asp:TextBox ID="txtColor" runat="server" Width="95%" Font-Size="Large"></asp:TextBox>
</div>
<div class="input">
<asp:ImageButton ID="imgbtnColorPicker" runat="server" ImageUrl="~/images/icons/colorpicker.png" />
</div>
<ajaxToolkit:ColorPickerExtender runat="server" ID="cpBackgroundColor" TargetControlID="txtColor" OnClientColorSelectionChanged="colorChanged"
SampleControlID="imgbtnColorPicker" PopupButtonID="imgbtnColorPicker" />
<div class="clear"></div>
</div>
<asp:HiddenField ID="hfColor" runat="server" />
和js:
function colorChanged(sender) {
sender.get_element().style.color =
"#" + sender.get_selectedColor();
};
如何在加载页面时从后面的代码中设置ColorPickerExtender颜色。从代码中我获取此元素的当前颜色并将其放在隐藏字段中。如何在ColorPickerExtender中触发有关更改颜色的事件?