我想在我的网站上开始多次倒计时,但我不明白为什么它不行你能帮帮我吗?
我得到每个“data-tempsctrl”的计时器
在LoadCtrlfreq2.php中:
<tr data-tempsctrl="0:00:35" class="color">
<td width="200px"><div class="countdown"></div>
</td>
<td width="150px"><button data-idctrl="50" data-result="ok" class="restartcount"> Conforme</button> <button data-idctrl="1" data-result="nok" class="restartnc"> non Conforme</button></td>
</tr>
<tr data-tempsctrl="0:00:55" class="color">
<td width="200px"><div class="countdown"></div>
</td>
<td width="150px"><button data-idctrl="50" data-result="ok" class="restartcount"> Conforme</button> <button data-idctrl="1" data-result="nok" class="restartnc"> non Conforme</button></td>
</tr>
<tr data-tempsctrl="0:01:35" class="color">
<td width="200px"><div class="countdown"></div>
</td>
<td width="150px"><button data-idctrl="50" data-result="ok" class="restartcount"> Conforme</button> <button data-idctrl="1" data-result="nok" class="restartnc"> non Conforme</button></td>
</tr>
以下功能用于每个计时器的显示倒计时 使用javascript的页面:
<script type="text/javascript">
$(document).ready(function(){
$('[data-tempsctrl]').each(function() {
startCountdown(this);
});
$('.restartcount').on('click', function(){
var action = "envoi";
var recfreq = '&action=' + action;
$.ajax({
type:'POST',
url:'LoadCtrlfreq2.php',
data:'ligne='+ligne,
success:function(html){
$('#acfreq').fadeIn("slow");
$('#acfreq').html(html);
}
});
clearInterval(countdown);
startCountdown(); });
});
</script>
<div class="acfreq" id="acfreq"></div>