我有一个没有背景色的div,然后我想更改两次背景色。这是我的代码:
function runForSeconds(second) {
var start = +new Date();
while (start + second * 1000 > (+new Date())) {}
}
var el = document.getElementById("foo");
el.style.backgroundColor = "blue";
// do some "long running" task
runForSecond