有谁知道我如何使用 Jquery 来更新 td id jailtimer 中的内容。我需要它倒计时直到它达到 0
例子
00:00:02
00:00:01
00:00:00 完成
<?php
$sql = "SELECT * FROM jail ORDER BY id DESC";
$query = mysql_query($sql) or die(mysql_error());
$count = mysql_num_rows($query);
$i = 1;
while($row = mysql_fetch_object($query)) {
$jail_oname = htmlspecialchars($row->username);
$jail_otimeleft = htmlspecialchars($row->time_left);
$oleft = $jail_otimeleft - time();
if ($oleft < '0'){
$sql = "DELETE FROM jail WHERE username='".$jail_oname."'";
$query = mysql_query($sql) or die(mysql_error());
}
?>
<table>
<tbody>
<tr>
<td id="jailtimer"><?php echo date( "00:i:s", $jail_otimeleft - time() ); ?></td>
</tr>
</tbody>
</table>
这是一个将数据放入mysql表的代码
<?
if ($_POST['Failcaptcha']){
$jailtime = 1500;
$Time_Jail=time()+ $jailtime;
echo "<p id=\"MyStatus\">You clicked the wrong button you goto jail for 25 Minutes!</p>";
mysql_query("INSERT INTO `jail` ( `id` , `username` , `time_left` , `reason` , `bust_able` )
VALUES ('', '$username', '$Time_Jail', 'Failed captcha', '1')");
}
?>