zoukankan      html  css  js  c++  java
  • aspx 提交按钮只能点一次

    表单只允许提交一次:在提交前把提交按钮设置成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, '......')" /> 

  • 相关阅读:
    springcloud之配置中心和消息总线(配置中心终结版)
    yaml
    RESTful API
    单元测试Junit5
    IDEA社区版创建web项目
    Mybatis常见面试题
    mybatis逆向工程
    mybatis注解
    延迟加载
    缓存
  • 原文地址:https://www.cnblogs.com/Kazaf/p/2875096.html
Copyright © 2011-2022 走看看