JavaScript如何给window.setInterval的函数传递参数

日期:2021-11-23 01:28:08 人气:1

JavaScript如何给window.setInterval的函数传递参数

function test(){alert("");}window.setInterval(test,1000); function test(username){ alert(username); }window.setInterval(function(){ test.apply(this,"comDeng"); },1000);这样以来,就将"comDeng"传递给test函数了。如果要做一个通用的处理方法的话,就可以写这样一个函数来实现
    A+
热门评论