2009年5月6日星期三

javascript input 计时激活

qqqq:<input name="aaa" disabled type="submit" id="move_check_btn" value="点击重新激活" />

<script language="javascript">
var activeTime = 8;

if( activeTime > 0 ) {
document.getElementById("move_check_btn").disabled=true;
var timer = setInterval('flush()', 1000);
} else {
document.getElementById("move_check_btn").disabled=false;
}
function flush(){
document.getElementById("move_check_btn").value=activeTime + '秒后重新激活';
activeTime--;
if(activeTime <= 0) {
clearInterval(timer);
document.getElementById("move_check_btn").value='点击重新激活';
document.getElementById("move_check_btn").disabled = false;
}
}
</script>

没有评论: