2
我發現這個腳本jQuery的多coundown
$(document).ready(function(){
$('tr[id]').each(function() {
var $this = $(this);
var count = parseInt($this.attr("id"));
countdown = setInterval(function(){
$('.remain', $this).html(count + " seconds remaining!");
if (count-- == 0) {
//do something
clearInterval(countdown);
}
}, 1000);
});
});
,並在HTML的代碼:
<table>
<tr id="4236377487">
<td class="remain"></td>
<td>Something</td>
</tr>
<tr id="768769080">
<td class="remain"></td>
<td>Something else</td>
</tr>
</table>
的結果是這樣的:
4236375205 seconds remaining! Something
768766798 seconds remaining! Something else
我有一個約會格式如下2011-10-29 10:05:00,我用<?php echo $date ?>
我需要的是將$ date傳遞給<tr id=
,以便顯示該日期的時間,但保持相同的格式Y-m-d H:i:s或甚至H:i:s將會很好。
我剛剛完成檢查http://keith-wood.name/countdown.html上的jQuery Countdown插件,但它不適合我,因爲我需要多次倒計時。
我希望這是明確的,你可以理解我的問題。 在此先感謝和抱歉,我的英語