防止表单多次提交
//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, ""));
轉(zhuǎn)載于:https://www.cnblogs.com/iamnumone/archive/2010/08/23/1806416.html
總結(jié)
- 上一篇: 凉菜猪手怎么做
- 下一篇: 黄山风景区没带身份证能进吗