源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

jquery设置按钮停顿3秒不可用

  • 时间:2020-11-28 18:40 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:jquery设置按钮停顿3秒不可用
[u]复制代码[/u] 代码如下:
<!DOCTYPE html> <html> <head> <title> my name is lian lily</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> var times = 0 function show(obj) { $("#btn_"+obj).attr("disabled","disabled");//设置button不可用 times++; if(times == 2){ alert(obj); times = 0; $("#btn_"+obj).removeAttr("disabled"); return ; } //$("#frm"+obj).submit(); setTimeout("show("+obj+")" , 3000); } </script> </head> <body> <form action ='post.php' method="post" name="frm1" id="frm1"> <input type="button" name="btn_1" id="btn_1" value="提交1" onclick="show(1)" /> </form> <form action ='post.php' method="post" name="frm2" id="frm2"> <input type="button" name="btn_2" id="btn_2" value="提交2" onclick="show(2)"/> </form> </body> </html>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部