简体   繁体   English

ASP.Net IE6禁用按钮

[英]ASP.Net IE6 disable button

I have the following code running as part of my OnClientclick attribute on my custom ASP.Net button.... 我在自定义ASP.Net按钮上将以下代码作为OnClientclick属性的一部分运行。...

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. 这在Firefox中效果很好,但在IE6中效果不佳。 Its almost like after the button has been disabled it simply does not run the post back javascript. 它几乎就像禁用按钮后一样,根本不运行回发JavaScript。

Any ideas welcomed. 任何想法都欢迎。

EDIT: I have tried returning true from the function as well. 编辑:我也尝试从函数返回true。

(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. 获得一次回发后,请检查呈现的HTML中的onclick="..." does it matchup the thing you've written? 它与您编写的内容相匹配吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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