Javascript to disable asp.net button
<p>I use the following Javascript to disable a button after click:</p>

<pre><code>var c = 0;
function DisableClick(target) {
    var objName = target;
    document.getElementById(objName).disabled = true;
    c = c + 1;
    msg = 'Please Wait...(' + c + ')!';
    document.getElementById(objName).value = msg;
    var t = setTimeout('DisableClick()', 1000);
}

&lt;asp:Button ID="btnLogin" runat="server" CssClass="cssLoginButton blue"  Text="Log in" ToolTip="Log in" ValidationGroup="UserLogin" onclick="btnLogin_Click" OnClientClick="DisableClick('btnLogin')" /&gt;
</code></pre>

<p>My Javascript gives this error:</p>

<blockquote>
  <p>Microsoft JScript runtime error: Unable to set value of the property 'disabled': object is null or undefined</p>
</blockquote>

<p><img src="http://i.stack.imgur.com/O2eDh.png" alt="Error Given by script"></p>

<p>How can I solve this?</p>
