微件:倒计时/js:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
<includeonly><script> | <includeonly><script type="text/javascript"> | ||
if(document.readyState == 'interactive' || document.readyState == 'complete') { | if(document.readyState == 'interactive' || document.readyState == 'complete') { | ||
// 页面已加载完成 | // 页面已加载完成 | ||
window.setInterval(CountDownShort, 1000); | |||
} else { | } else { | ||
// 没加载完,监听加载完成事件 | // 没加载完,监听加载完成事件 | ||
document.addEventListener("DOMContentLoaded", function () { | document.addEventListener("DOMContentLoaded", function () { | ||
window.setInterval(CountDownShort, 1000); | |||
}); | }); | ||
} | } | ||
function CountDownShort() { | function CountDownShort() { | ||
var a = document.getElementsByClassName("CDScontainer"); | var a = document.getElementsByClassName("CDScontainer"); | ||
第28行: | 第17行: | ||
for (var i = 0; i<a.length; i++) { | for (var i = 0; i<a.length; i++) { | ||
var s = parseInt(a[i].getAttribute("data-time"), 10); | var s = parseInt(a[i].getAttribute("data-time"), 10); | ||
var t = a[i].getAttribute("data-event") | var t = a[i].getAttribute("data-event") || '' | ||
if( | if(t) { | ||
t = '距离'+ t + '还有' | t = '距离'+ t + '还有' | ||
} | } |