按钮中有个类,可以执行一段JS代码!
做一个短信获取验证码的按钮,怕刷新慢! 不能重复点.

解决方案 »

  1.   

    设置一个变量置 为false
    settimeout 15s之后变为true
      

  2.   

    使用JS里的SetTimeout方法
    按钮的Click事件里
    btn.enable = false;
    SetTimeout(15000,btn.enable=true;)
      

  3.   

    <script>
      function forbid(o)
      {
        o.disabled=true;
        window.setTimeout(function(){o.disabled=false;},2000);
      }
    </script>
    <input type="button" value="button" onclick="javascript:forbid(this);" />
      

  4.   

    这个按钮要用到ajax,页面不能刷新.
      

  5.   

    我现在还不会ajax 都不知道 是什么原理! 跟按钮有关系不
      

  6.   


    我之前试过用enable,可是按钮无法触发服务器端事件,不知道用disabled怎么样
      

  7.   

    <tr>
            <td width="200"><asp:DropDownList ID="ddl_type" runat="server"></asp:DropDownList></td>
            <td width="200"><asp:DropDownList ID="ddl_hy_type" runat="server"></asp:DropDownList></td>
            <td width="400"><asp:Button ID="btn_ok" runat="server" Text="确定" OnClick="btn_ok_Click" /></td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:TextBox ID="tb_mobile" runat="server" TextMode="MultiLine" Height="258px" Width="790px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <input type="button" name="allCopy" id="btn_copy" value="全部复制" onclick="contentCopy()"  />
                <script type="text/javascript">
                  function contentCopy(){
                   //获取到对象
                   var obj = document.getElementById("<%=tb_mobile.ClientID %>");
                   //选择文本框中得所以内容
                   obj.select(); 
                   //执行复制功能
                   document.execCommand("copy");
                  }
                 </script>
           <script> 
           function forbid() 
            { 
              var obj = document.getElementById("<%=btn_ok.ClientID %>");          window.setTimeout(function(){obj.Attribute("disabled"="disabled";},2000); 
            } 
           </script> 
                <input type="button" value="button" onclick="javascript:forbid();" />
            </td>
        </tr>
      

  8.   


    他要的代码其实是img换个图片+我写的那个功能...跟服务端事件没关系
      

  9.   


    <script> 
      function forbid(o) 
      { 
        o.disabled=true; 
        window.setTimeout(function(){o.disabled=false;},2000); 
      } 
    </script> 
    <input type="button" value="button" onclick="javascript:forbid(this);" runat="server" />
    加个runat="server" 就OK了.
      

  10.   

    加个runat="server" 就OK了.就和服务器控件一样了.你试试,
      

  11.   

    既然你要用到ajax,ajax在原理是这样的:将当前要进行处理的数据异步的方式发给服务器某个指定的页面进行处理,最后将处理后的结果通过response.write()这个方法返回给当前页面.
    js部分:
    <script language="javascript" type="text/javascript">
    var xmlhttp;
    function CheckCode()
    {document.getElementById("<%=bt.ClientID%>").disabled=true;//设置提交按扭不可用
     xmlhttp=CreateXmlRequestObj();
     xmlhttp.open("服务器端进行处理的页面的路径+"?"+要进行处理的数据");//格式如:a.aspx?id=2&name=test;
     xmlhttp.onreadystatechange=HandleFunctionName;
     xmlhttp.send(null);
    }
    function HandleFunctionName()
    { if(xmlhttp.readyState==4&&xmlhttp.Stuts==200)//返回数据成功的话
       {
        setTimeout(function()
         {document.getElementById("<%=bt.ClientID%>").disabled=false;},15000);
      }
    }
    function CreateXmlRequestObj()

       var xmlhttpRequest;
       if(window.ActiveXObject)
       {xmlhttpRequest=new ActiveXObject("Microsoft.XMLHTTP")
       }
       else if(window.XMLHttpRequest)//非IE浏览器
       {xmlhttpRequest=new XMLHttpRequest();}
       else
       { alert("创建XMLHttpRequest对象失败!"); return;}
       return xmlhttpRequest;
    }
    </script><asp:button ID="bt" runat="server" text="提交" onClientClick="你的js方法" onClick="后台事件" />