SETTimeout函数立即调用,而不是在延迟后调用。
window.onload = function GetUsersNumber() { aside = document.getElementById("users"); if (XMLHttpRequest) var x = new XMLHttpRequest(); else var x = new ActiveXObject("Microsoft.XMLHTTP"); x.open("GET", "users_count.php", true); x.send(); x.onreadystatechange = function () { if (x.readyState == 4) { if (x.status == 200) aside.innerHTML = x.responseText; setTimeout(GetUsersNumber(), 50000); } }}
米脂
慕运维8079593
相关分类