<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> New Document </title>
<meta http-equiv="content-type" content="text/html;charset=gbk">
</head>
<body>
<input type="button" onclick="fsdx();" value="获取短信验证码" id="hqdxyzm"/>
</body>
</html>
<script language="JavaScript" type="text/javascript">
var _hqdxyzm=document.getElementById("hqdxyzm");
var _dsqId;//定时器id
//每1秒该值增加1
var keep=1000;
var startTime=0;
var endTime=0;//结束为6秒
var resultTime=600;
function fsdx(){
_hqdxyzm.disabled=true;
if(resultTime!=endTime){
//每隔一秒执行一次
_dsqId=window.setInterval(tip,keep);
}else{
//取消定时
window.clearInterval(_dsqId);
_hqdxyzm.disabled=false;
}
}
function tip(){
resultTime--;
_hqdxyzm.value=resultTime+"秒后重新获取";
}
</script>