==============================JS部分================================
<script type="text/javascript">
var countdown = 60;
//获取验证码60秒倒计时
function settime() {
document.getElementById("messageCode_warning").style.display = "block";
if (countdown == 0) {
$("#msg_button1").val("获取验证码");
document.getElementById("messageCode_warning").style.display = "none";
countdown = 60;
clearInterval(intervalid);
} else {
$("#msg_button1").val(countdown + " 秒");
countdown--;
}
setTimeout(function() {
settime()
}, 1000)
}
</script>
================================HTML部分================================
<input type="button" id="msg_button1" οnclick="settime()" value="获取验证码"/>
<br />
<div id="messageCode_warning" style="display:none;">
60秒后可重新获取验证码
</div>