表单只允许提交一次:在提交前把提交按钮设置成disable即可。
有两点需要注意:一是页面验证没通过不能disable;
二是submit类型的按钮disable后,服务器端提交事件不能触发,只能用button类型的按钮。
function clickOnce(btn, msg) { if (typeof(Page_ClientValidate) == 'function') { if (Page_ClientValidate() == false) {
// Ensure that the button is not of type "submit"
if (btn.getAttribute('type') == 'button') {
if (!msg || (msg=='undefined')) { msg = 'Loading...'; } btn.value = msg; tn.disabled = true; } return true; }<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="OnceClickMe" ValidationGroup="SubgurimTest" UseSubmitBehavior="false" OnClientClick="clickOnce(this, '......')" />