var h1 = document.querySelector('h1') var btn = document.querySelector('button') // 死循环指定的时间 function delay(duration) { var start = Date.now() while (Date.now() - start < duration) {} } let count = 1 btn.onclick = function () { h1.textContent = '雪月真帅!+' + count++ delay(1000) }