加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

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

发布时间:2023-10-26 15:29:36 所属栏目:教程 来源:
导读:代码如下:

<!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.g
代码如下:
 
<!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>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章