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, ""));

  • 相关阅读:
    jq的遍历与杂项
    jq的事件
    jquery的效果
    jquery入门
    面向对象。对象的继承
    面向对象克隆对象
    面向对象this指向问题
    实例对象及原型链
    GCD多线程任务总结
    C语言链表的简单实用
  • 原文地址:https://www.cnblogs.com/iamnumone/p/1806416.html
Copyright © 2011-2022 走看看