用了settimeout()想实现递归调用,如果第一个参数不加引号的话,火狐提示settimeout():uselesssettimeout call (missing quotes around argument?)如果加引号的话 ,火狐会提示那个函数undefined
function refreshNum() {
$.ajax({
type: "POST",
url: "ajax/RefreshNum.ashx",
async: false,
data: {},
success: function (data) {
varnumArry = data.split(',');
$.each($(".rush_left"), function (n) {
$(this).children().eq(0).html(numArry[n]);
});
setTimeout(function () { refreshNum(); }, 3000);
//setTimeout("refreshNum",3000); //这样写就会出错,setTimeout()函数的参数,第一个一定不要用简单的函数调用,而是使用匿名函数!至于为什么就不知道了
}
});
}
refreshNum();
java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号