手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery设置按钮停顿3秒不可用
jquery设置按钮停顿3秒不可用
摘要:复制代码代码如下:mynameislianlilyvartimes=0functionshow(obj){$("#btn_"+obj).at...

复制代码 代码如下:

<!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" />

</form>

<form action ='post.php' method="post" name="frm2" id="frm2">

<input type="button" name="btn_2" id="btn_2" value="提交2"/>

</form>

</body>

</html>

【jquery设置按钮停顿3秒不可用】相关文章:

jquery读取xml文件实现省市县三级联动的方法

jquery任意位置浮动固定层插件用法实例

jquery中map函数遍历数组用法实例

jQuery 遍历函数详解

jQuery封装的tab选项卡插件分享

jQuery处理图片加载失败的常用方法

jquery滚动特效集锦

jQuery插件支持同一页面被多次调用

jquery实现图片左右切换的方法

jquery右下角自动弹出可关闭的广告层

精品推荐
分类导航