JavaScript异步调用定时方法并停止该方法实现代码
代码如下: (function() { var t = window.setInterval(function() { $(‘#ajaxGame’).load(‘RefreshCurrentPlayerServlet #ajaxGame’, function() { youWin(); youlose(); }); }, 10000); function youWin() { if ($(‘#status:contains(“YOU ARE THE WINNER!”)’).length) { alert(“YOU ARE THE WINNER!”); clearInterval
用户评论