ASP.NET 按钮单击一次后,十五秒内,不能再点!谁有好的方法! 按钮中有个类,可以执行一段JS代码!做一个短信获取验证码的按钮,怕刷新慢! 不能重复点. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置一个变量置 为falsesettimeout 15s之后变为true 使用JS里的SetTimeout方法按钮的Click事件里btn.enable = false;SetTimeout(15000,btn.enable=true;) <script> function forbid(o) { o.disabled=true; window.setTimeout(function(){o.disabled=false;},2000); }</script><input type="button" value="button" onclick="javascript:forbid(this);" /> 这个按钮要用到ajax,页面不能刷新. 我现在还不会ajax 都不知道 是什么原理! 跟按钮有关系不 我之前试过用enable,可是按钮无法触发服务器端事件,不知道用disabled怎么样 <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> 他要的代码其实是img换个图片+我写的那个功能...跟服务端事件没关系 <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了. 加个runat="server" 就OK了.就和服务器控件一样了.你试试, 既然你要用到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="后台事件" /> 跪求一个可以自己输入开始时间和结束时间,等待时间的控件 大家帮忙看下,问题出在哪里? 创意,高手快看,如何做一个推荐引擎 望高手解答 请问在上海什么地方可以买到这本好书???(非邮寄) 复杂的应用问题 如何实现鼠标点击日历控件显示? 简单的用数据填充表格的问题 100分高分求大神解决js传递参数的问题 关于ocx控件打包成cab 然后自动下载安装的问题!高手菜鸟都请关注一下,救命啊!谢谢! 导出excel文件问题 回答给分,强者高
settimeout 15s之后变为true
按钮的Click事件里
btn.enable = false;
SetTimeout(15000,btn.enable=true;)
function forbid(o)
{
o.disabled=true;
window.setTimeout(function(){o.disabled=false;},2000);
}
</script>
<input type="button" value="button" onclick="javascript:forbid(this);" />
我之前试过用enable,可是按钮无法触发服务器端事件,不知道用disabled怎么样
<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>
他要的代码其实是img换个图片+我写的那个功能...跟服务端事件没关系
<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了.
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="后台事件" />