简体   繁体   中英

ASP.Net IE6 disable button

I have the following code running as part of my OnClientclick attribute on my custom ASP.Net button....

function clickOnce(btnSubmit) {
    if ( typeof( Page_ClientValidate ) == 'function' ) {
        if ( ! Page_ClientValidate() ) { 
            return false;
        }
    }    
    btnSubmit.disabled = true;        
}

There is a validator on the page.

  • If a given text box is empty then the validator activates no problem.
  • If a given text box is populated then the button disables but a post back does not occur.

The rendered markup looks like this...

<input type="submit" name="TestButton" value="Test Button" onclick="clickOnce(this);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;TestButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="TestButton" class="euva-button-decorated" />

This works nicely in Firefox but not in IE6. Its almost like after the button has been disabled it simply does not run the post back javascript.

Any ideas welcomed.

EDIT: I have tried returning true from the function as well.

(Ps: I wanted to add this as a comment to your question, but I couldn't find the respective button. So adding as the answer.)

After getting the postback once, check the onclick="..." in the rendered HTML. does it matchup the thing you've written?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM