简体   繁体   English

防止回发

[英]Prevent this postback

I want to be able to prevent this postback without actually editing the HTML itself. 我希望能够在不实际编辑HTML本身的情况下防止这种回发。

<a class="button campaign-button" id="ctl00_main_fastcheckout_FastCart_FastDiscount_lbDiscountCode" href="javascript:__doPostBack('ctl00$main$fastcheckout$FastCart$FastDiscount$lbDiscountCode','')"><span>OK</span></a>

Is there a default way of disabling postbacks perhaps on document load? 是否有默认的方法可能禁用文档加载中的回发?

Thanks :) 谢谢 :)

You can always use return false . 您可以始终使用return false

OnClientClick="yourFunction(); return false;"

In js : js

yourFunction(){
    //code
    return false;    
}

Try this Java script on your page 在页面上尝试此Java脚本

window.__doPostBack = function(eventTarget, eventArgument) {
return false;
};

But this is not the recommended way. 但这不是推荐的方法。

check out this how-does-the-dopostback-method-get-called-where-is-the-calling-method 看看这个dopostback方法如何被称为调用方法在哪里

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

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