递归,不能直接for
function execFor(i, max) { alert(i); i++; if (i <= max) setTimeout(function () { execFor(i, max); }, 1000); } execFor(0,3)