Why is the label not changing color using RegisterClientScriptBlock?
<p>I have an aspx page defined as follows:</p>

<pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
&lt;title&gt;&lt;/title&gt;

   &lt;script type="text/javascript" language='javascript'&gt;
       function changecolor() {
           var lbl = document.getElementById('lblDisplayDate');
           lbl.style.color = 'red';
       };
  &lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
    &lt;asp:Label ID="lblDisplayDate" runat="server" 
               Text="Label"&gt;&lt;/asp:Label&gt;&lt;br /&gt;

    &lt;asp:Button ID="btnPostBack2" runat="server" 
                Text="Register Client Block Script" 
                onclick="btnPostBack2_Click" /&gt;

&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>
</p>

<p>Here is the btnPostBack2 Click event:</p>

<pre><code>protected void btnPostBack2_Click(object sender, EventArgs e)
{
    if (!ClientScript.IsClientScriptBlockRegistered("JSScriptBlock"))
    {
        ClientScript.RegisterClientScriptBlock(this.GetType(), 
        "JSScriptBlock", 
        "changecolor();",
        true);
    } 
}
</code></pre>

<p>Even though, I put the script in a function to change the color, it is still not doing it and why do I need to add the script tags to true if the function is already enclosed in script tags?</p>

<p>lblDisplayDate is in the Page Load where it is set to the current time on every page reload.</p>
