Return value from Javascript function assigned to Label the properties of Label is changing
<p>In Javscript function i am assigning a value to Label. Value is assigned but the label properties are changing to default values.</p>

<pre><code>document.getElementById("Label1").innerText = dispTime;
</code></pre>

<p>Where <strong>dispTime</strong> is some value in javascript function.</p>

<pre><code>&lt;asp:Label ID="Label1" runat="server" ToolTip="Current Time" ForeColor="BlueViolet" BorderStyle="Ridge" BackColor="ButtonHighlight"&gt;&lt;/asp:Label&gt;
</code></pre>

<p>This is how my <strong>Label</strong> defined but after page load the Label properties changing to default values</p>

<p>My Page_Load </p>

<pre><code>ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:InIt();", true);
</code></pre>

<p>My javascript part</p>

<pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head id="head1" runat="server"&gt;
&lt;title&gt;Time&lt;/title&gt;
&lt;script type="text/javascript"&gt;
function InIt() {
    var dateTime = new Date();
    var hours = dateTime.getHours();
    var minutes = dateTime.getMinutes();
    var seconds = dateTime.getSeconds();
    var day;
    if (hours &lt; 11) {
        day = "AM";
    }
    else {
        day = "PM";
    }
    if (minutes &lt; 10) {
        minutes = "0" + minutes;
    }
    if (seconds &lt; 10) {
        seconds = "0" + seconds;
    }
    var dispTime = document.getElementById("time").innerHTML = hours + ":" + minutes + ":" + seconds + " " + day;
    setTimeout("InIt()", 1000);
    var updatetime = document.getElementById("Label1");
    updatetime.innerText = dispTime;
}
InIt();
&lt;/script&gt;
</code></pre>

<p>
</p>

<pre><code>&lt;form id="form1" runat="server"&gt;
&lt;div id="time" runat="server"&gt;
&lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
&lt;/asp:ScriptManager&gt;
    &lt;asp:Label ID="Label1" runat="server" ToolTip="Current Time" style="background-color:ButtonHighlight; border-style:ridge;"&gt;&lt;/asp:Label&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>
</p>
