<script type="text/javascript">
$(function() {
var newYear = document.getElementById('HF');
alert('hehe' + newYear);
$('#countdown').countdown({ until: newYear, format: 'DHMS', layout:
'<div id="timer">' + '<hr />' +
'<div id="timer_days" class="timer_numbers">{dnn}</div>' +
'<div id="timer_hours" class="timer_numbers">{hnn}</div>' +
'<div id="timer_mins" class="timer_numbers">{mnn}</div>' +
'<div id="timer_seconds" class="timer_numbers">{snn}</div>' +
'<div id="timer_labels">' +
'<div id="timer_days_label" class="timer_labels">days</div>' +
'<div id="timer_hours_label" class="timer_labels">hours</div>' +
'<div id="timer_mins_label" class="timer_labels">mins</div>' +
'<div id="timer_seconds_label" class="timer_labels">secs</div>' +
'</div>' +
'</div>'
});
});
</script>
我如何在页面上多次使用此脚本?我在页面上有三个listViews
所以我想要使用它3次?我该怎么做?
答案 0 :(得分:1)
您可以倒计时class
而不是id
,因此您可以使用$(".countdown")
选择器。
答案 1 :(得分:0)
从使用$('#countdown').
更改为按类$('.countdown').
答案 2 :(得分:0)
给列表视图提供相同的类,例如。 .countdown然后将您的JavaScript更改为$('。countdown')。countdown(...