简体   繁体   中英

How to avoid postback with javascript

Content of my page is:

 <form id="form1" runat="server"> <div> <asp:TextBox ID="txtAccountNumber" runat="server"></asp:TextBox> <asp:Button ID="btnTransfer" runat="server" Text="Transfer" OnClientClick="ValidateTheAccountNumber()" /> </div> </form> 

I wrote this script:

function ValidateTheAccountNumber() { return false; }

I think, with this js function, the page can't postback.But it does.Please say me what is the wrong point that I do?

Thanks!

您还必须返回函数调用的结果

... OnClientClick="return ValidateTheAccountNumber()" />

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