I am trying to change the color of a texbox in upodate panel. It is txtTask in the code below. The change will not persist when i select from the listbox - it flashes red then goes back to white (the defualt). If I take the textbox out of the panel it will work. Is there a way around this problem. The change in color only happens when a radio button is selected.
<script type="text/javascript">
var $ = function (id) {
return document.getElementById(id);
}
var color;
//Function attached to the onmouseover event for the ASP.NET Button control.
function ChangeColor() {
color = window.event.srcElement.style.color;
window.event.srcElement.style.color = "blue";
}
function flagRed(cnt) {
$(cnt).style.backgroundColor = "#F9966B";
}
function flagClear(c) {
$(c).style.backgroundColor = "white";
}
var ct = function() {
// $("txtTask").value = ""
}
var kw = function() {
var status = "unknown";
if ($("RBTravel").checked) {
// alert("flagred");
flagRed("RBTravel");
flagRed("txtTask");
}
else if ($("RbDRB").checked) {
// alert("Clear");
flagClear("RBTravel");
flagClear("txtTask");
}
else if ($("RbKW").checked) {
// alert("RBKW");
flagClear("RBTravel");
flagClear("txtTask");
}
}
var listred = function() {
if ($("RBTravel").checked) {
// alert("listred");
flagRed("txtTask");
}
else if ($("RbDRB").checked) {
// alert("Clear");
flagClear("txtTask");
}
else if ($("RbKW").checked) {
// alert("RBKW");
flagClear("txtTask");
}
}
window.onload = function() {
$("RBTravel").onclick = kw;
$("RbKW").onclick = kw;
$("RbDRB").onclick = kw;
listred();
// $("butSave").onclick = cleartask;
$("ListBox1").onclick = listred;
// $("butSave").onclick = kw;
}</script></head><body id="body"><form id="form1" runat="server"><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager><div id="top"><h1>DRB TIMESHEET</h1><p> Test:<script type="text/javascript">
var today = new Date();
document.writeln(today.getFullYear());</script></p></div><div id="div_left"><h2>SELECT CASE</h2><asp:ListBox ID="ListBox1" runat="server" Height="626px"
style="margin-right: 0px; margin-top: 24px;" Width="270px"
DataSourceID="ObjectDataSource1" DataTextField="CaseName"
DataValueField="CaseID" Font-Bold="False" Font-Names="Arial"
Font-Size="Medium" onclientclick="listred()" AutoPostBack="True"></asp:ListBox><asp:UpdatePanel ID="UP_LBox" runat="server"><ContentTemplate></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="ListBox1" EventName="SelectedIndexChanged" /></Triggers></asp:UpdatePanel></div><asp:UpdatePanel id="UP_Task" runat="server" RenderMode="Inline"><ContentTemplate><!-- *********************************************************Task Text Box --><asp:TextBox ID="txtTask" runat="server" Font-Size="Medium"
TextMode="MultiLine" Width="427px"></asp:TextBox></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="butSave" EventName="click" /></Triggers></asp:UpdatePanel></p></div>