2 回答
TA贡献1831条经验 获得超10个赞
您可以在大多数现代 Javascript 引擎中使用 Performance 接口。
let start = performance.now();
let timer = document.getElementById("timer");
for(let i = 0;i<5000;i++){
timer.innerText = i;
}
let end = performance.now();
let elapsed = end - start;
timer.innerText += " that took "+elapsed+" ms"
<h1 id="timer"></h1>
TA贡献1804条经验 获得超8个赞
这就是它的工作原理。:-)
var z = (document.getElementById("ABZ").value).split(':').join(',').split('.').join(',').split(',').join(',').split(',');
var y = new Date();
var generatedDate = new Date(y.getFullYear(), y.getMonth(),y.getDate(),z[0], z[1], z[2], z[3], z[4], z[5]);
var calculatedDate = generatedDate - y;
var h = Math.floor((calculatedDate % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var m = Math.floor((calculatedDate % (1000 * 60 * 60)) / (1000 * 60));
var s = Math.floor((calculatedDate % (1000 * 60)) / 1000);
var ms = Math.floor((calculatedDate % 1000));
document.getElementById("COUNTDOWN").innerHTML = ( h + ':' + m + ':' + s + ':' + ms);```
添加回答
举报