今天完成的:昨天短信验证发送之后显示倒计时但点发送还会再发送请求的问题已经得到解决
<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目录下启动服务器跳转欢迎页应写完整路径