您的位置:首页 > 其它

发送短信验证码计时

2016-07-23 19:37 267 查看
今天完成的:昨天短信验证发送之后显示倒计时但点发送还会再发送请求的问题已经得到解决
<script type="text/javascript">

$(function() {
$('#validationCode').click(function () {
if ($(this).attr('disabled') == 'disabled') {
return;
}
var telephone = document.getElementById("telephone");
var value = telephone.value.trim();
var countdown = 60;
setTime();
function setTime() {
var val = document.getElementById("validationCode");
if(countdown == 60){
$.ajax({
cache: false,
url: "sendTelephoneCode.shtml",
data: {telephone: value}
});}
if (countdown == 0) {
val.removeAttribute("disabled");
val.innerHTML = "发送";
countdown = 60;
return;
} else {
val.innerHTML = countdown + "秒";
val.setAttribute("disabled", true);
countdown--;
}
setTimeout(function () {
setTime(this);
}, 1000)
}
});
})
</script>




--------------------

明天计划的:完成图片上传的代码。

-------------------

<welcome-file-list>

<welcome-file>/WEB-INF/views/index.jsp</welcome-file>

</welcome-file-list>

jsp文件放在WEB-INFO目录下启动服务器跳转欢迎页应写完整路径
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: