日期:2014-05-16  浏览次数:20604 次

JavaScript 倒计时 (由实现数据库时时更新 引出的 )
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>倒计10秒再提交</title>
<script language="JavaScript">
           var i=10;
           function change(){
		var btn=document.getElementById("button");
		i--;
		if(i != 0){
			btn.value="Agree "+i;
		}else{
			btn.value="Agree";
		}
		
		if(i==0){ 
			btn.disabled=false;
               ?}else{
			setTimeout("change()",1000);
		}
	}
</script>
</head>

<body onload="change()">
	<form method="post" id="form1">
   <input type='submit' id="button" disabled="disabled" value="Agree">
   </form>
</body>
</html> 
?

实现数据库实时更新 jQuery Timers

?