JQuery实现倒计时按钮具体方法
jquery实现倒计时按钮具体代码如下:
<head>
<title>test count down button</title>
<script src="https://ajax.netcdn.com/ajax/jquery/jquery-1.5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btn').click(function () {
var count = 3;
var countdown = setinterval(countdown, 1000);
function countdown() {
$("#btn").attr("disabled", true);
$("#btn").val("please wait " + count + " seconds!");
if (count == 0) {
$("#btn").val("submit").removeattr("disabled");
clearinterval(countdown);
}
count--;
}
})
});
</script>
</head>
<body>
<input type="button" id="btn" value="submit" />
</body>
有兴趣您可以自己实现一下。