Php jQueryMultipleConcountDown
我找到了这个脚本Php jQueryMultipleConcountDown,php,jquery,countdown,Php,Jquery,Countdown,我找到了这个脚本 $(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!")
$(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>
我有一个日期,格式如下2011-10-29 10:05:00,我用
我需要的是将$date传递给试试这个
$(document).ready(function(){
$('tr[id]').each(function () {
var $this = $(this);
var count = parseInt($this.attr("id"));
countdown = setInterval(function(){
var curDate = (new Date()).getMilliseconds();
var newDate = new Date(count-curDate);
var dateString = newDate.getHours() + ":" + newDate.getMinutes() + ":" + newDate.getSeconds();
$('.remain', $this).html(dateString + " seconds remaining!");
if (count-- == 0) {
//do something
clearInterval(countdown);
}
}, 1000);
});
});
试试这个
$(document).ready(function(){
$('tr[id]').each(function () {
var $this = $(this);
var count = parseInt($this.attr("id"));
countdown = setInterval(function(){
var curDate = (new Date()).getMilliseconds();
var newDate = new Date(count-curDate);
var dateString = newDate.getHours() + ":" + newDate.getMinutes() + ":" + newDate.getSeconds();
$('.remain', $this).html(dateString + " seconds remaining!");
if (count-- == 0) {
//do something
clearInterval(countdown);
}
}, 1000);
});
});