JavaScript sometimes prevents server event from firing with asp.net
<p>I have what I thought was a pretty straightforward javascript issue, but I'm starting to go nuts trying to figure out my problem.</p>

<p>I have a slow page, and it was possible for users to click submit, then click another button while waiting on the page to load, it was creating issues.  I thought I could display a please wait message and disable the submit button on click.  Below is the function, I am using asp.net 3.5 so there's a name mangling issue, because of this I was using a getElemenetsByName and scanning for the right items (not awesome but it seems to work).  When I run this, the button becomes disabled, but then the page just sits there, the server never gets called.  I tried in firefox and I didn't see any errors in firebug, but when I set a breakpointon the server, the server def does not get called.  I tried returning true in case there was an output expected, but nada.  When I commend out the content of <code>processing(){ // stuff }</code> then it works fine, so something in there seems to be killing me.</p>

<pre><code>function processing() {
    var pleaseWaitID = "lblPleaseWait";
    var submitBtnName = "btnSubmit";
    var submitControl = document.getElementsByTagName('input');

    var pleaseWaitlbls = document.getElementsByName(pleaseWaitID);

    for (pleaseWait in pleaseWaitlbls) {
       if (pleaseWaitlbls[pleaseWait].style != null) {
            pleaseWaitlbls[pleaseWait].style.visibility="visible";
       }
    }

    for (submitButton in submitControl) {
       if (submitControl[submitButton].name != null) {
           if (submitControl[submitButton].name.search(submitBtnName) != -1) {
               submitControl[submitButton].disabled = "disabled";
           }
       }
    }

    return true;
}
</code></pre>

<p>.....</p>

<pre><code> asp:Button ID="btnSubmit" name="btnSubmit" SkinID="MainAction" runat="server" Text="Submit" OnClientClick = "javascript:processing();"
 OnClick="btnSubmit_Click" meta:resourcekey="btnSubmitResource1"
</code></pre>

<p>Any ideas on what I've screwed up here?</p>

<p>Thanks you for your time.</p>
