zoukankan      html  css  js  c++  java
  • 防止表单多次提交

    //jQuery

    <script type="text/javascript">
    $("input:submit").each(function() {
    var srcclick = $(this).attr("onclick");
    if(typeof(srcclick)=="function"){
    $(this).click(function() {
    if (srcclick()) {
    setdisabled(this);
    return true;
    }
    return false;
    });}
    });
    function setdisabled(obj) {
    setTimeout(function() { obj.disabled = true; }, 100);
    }
    </script>

      function disableOtherSubmit()
        {
            $("input:submit").each(function(i) {
            setTimeout(function() { $("input:submit").eq(i).attr("disabled","true"); }, 100); });
        }
    //ASP.NET
      Button_All.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(Button_All, ""));
                Button_CurrentCount.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(Button_CurrentCount, ""));
                Button_Between.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(Button_Between, ""));

  • 相关阅读:
    test
    在linux下安装tesseract-ocr
    xpath获取同级节点
    RobotFrameWork系统关键字之断言
    redis
    mybatis
    mysql事务隔离级别
    努力努力再努力
    不同分辨率下,页面如何自适应?
    市场上有多少种分辨率?
  • 原文地址:https://www.cnblogs.com/iamnumone/p/1806416.html
Copyright © 2011-2022 走看看