js短信验证码

短信验证码,无注释,url顺便写的错的,所以会报错

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>短信验证码 </title>
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<style>
.sign_call span,input,p{
float: left;
}
</style>
</head>
<body>
<div class="sign_call">
<span>验证码:</span>
<input type="text" placeholder="请输入短信验证码" />
<p onclick="">
<span id="btn" onclick="thetime(this.id)">获取验证码</span>
</p>
</div>
<script>
function thetime(p){
var wait = 60;
document.getElementById(p).disabled = false;
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.innerHTML = "重新获取验证码";
wait = 60;
o.setAttribute("onclick","thetime(this.id)");
} else {
o.setAttribute("disabled", true);
o.removeAttribute("onclick");
o.innerHTML = wait + "秒后重新获取";
wait--;
setTimeout(function () {
time(o)
},1000)
}
}
time(document.getElementById(p));
var mobile = document.getElementById('btn').value; $.ajax({
type: "POST",
url: "http://che.anet.cn/index.php/Ios/UserTest/ajaxtest",
data: 'mobile='+mobile,
dataType: 'json',
success: function(msg){
if(msg.status == 1){
alert(msg.content);
}else{
alert(msg.content);
}
}
}); } </script>
</body>
</html>

正在练习,可能有错误

上一篇:RN组件备忘录


下一篇:怎么简单获取input file 选中的图片,并在一个div的img里面赋值src实现预览?