因此,我试图在获取截止日期值的表上添加一个倒数计时器,并添加一个显示剩余时间的单元格。目前,它适用于一条记录,但在添加两行或多行时,我得到了最后一行计时器的副本,复制了所有记录的计时器单元
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-table"></i> <sup><span class="badge badge-warning"> {{ new}} New</span></sup>New Orders From Clients
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<td>Reference Code</td>
<td>Title</td>
<td>Number of Pages</td>
<td>Take this Task</td>
<td>Due Date</td>
<td>Remaining Time</td>
</thead>
{% for t in order %}
<tbody>
<tr>
<td>
<a href="{% url 'view_order' pk=t.pk %}">{{ t.urlhash }}</a>
</td>
<td>{{ t.title }}</td>
<td>{{ t.Number_of_pages }}</td>
<td>
{% if t.status == False %}
<a href="{% url 'claim' pk=t.pk %}" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm">Take order</a>{% else %}
<span>✔ Taken</span> {% endif %}
</td>
<td>{{ t.due_date }} </td>
<td id="time" class="text-warning"></td>
</tr>
<script>
// Set the date we're counting down to
var countDownDate = new Date("{{ t.due_date.isoformat }}").getTime();
// console.log(dex);
//var countDownDate = new Date("July 18, 2020 19:27:25").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
慕容708150
相关分类