点击后disabled掉
处理完再恢复

解决方案 »

  1.   

    <input type="submit" id="btnSub" onclick="javascript:this.disabled=true;" value="提交" />
      

  2.   

    点击后disabled掉
    处理完再恢复,
    再从数据库中建立唯一键值,不能插入重复的内容,通过捕获异常来提示行于客户的交互
      

  3.   

    点击完提交按钮,将它禁用(disabled=true),后台处理完以后redirect回来
      

  4.   

    <script language="javascript">

    setTimeout('document.getElementById("btn").disabled=false',5000);
    </script>
    <INPUT id=btn  onclick="this.disabled=true" type="button"
    value="Button">
      

  5.   

    刚才有错 只能使用input button 不能用submit按钮 或服务器端按钮
    testBtn.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testBtn.aspx.cs" Inherits="testBtn" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>        
            <input id="Button1" type="button" onclick="this.disabled=true;" value="提交" onserverclick="Button1_ServerClick" runat="server" /></div>
        </form>
    </body>
    </html>.csusing System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class testBtn : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
       
        protected void Button1_ServerClick(object sender, EventArgs e)
        {
            Response.Write("ttttttttttttttttttt");
            System.Threading.Thread.Sleep(5000);        Page.RegisterStartupScript("enBtn", "<script>document.getElementById('Button1').disabled=false;</script>");
        
        }
    }
      

  6.   

    //为查询数据时防止多次提交而设置 保证 __doPostBack(eventTarget, eventArgument) 正确注册
    page_load的时候,不要放在if(!this.IsPostBack)中
    this.Page.GetPostBackEventReference(this.btn_Search);
    --------------------------------------------------------------------------------- this.btn_Search.Attributes.Add( "onclick" , "if(SearchCheck()){this.disabled=true;this.value='数据查询中...';"+this.Page.GetPostBackEventReference(this.btn_Search)+";}else{return false;}" );
    //主要是用来防止多次提交而设置 this.Page.GetPostBackEventReference(this.btn_Search)是用__doPostBack来提交,保证按钮的服务器端click事件执行 加入原因:当disabled=true时不能执行服务器事件
      

  7.   

    或者可以将 下面的函数加到 pageload中
    不缓存客户端protected void NoCatchOutPage()
        {
            HttpContext.Current.Response.Buffer = true;
            HttpContext.Current.Response.Expires = 0;
            HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); //DateTime.Now.AddDays(-1);
            HttpContext.Current.Response.AddHeader("pragma", "no-cache");
            HttpContext.Current.Response.AddHeader("cache-control", "private");
            HttpContext.Current.Response.CacheControl = "no-cache";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(true);
        }