我一直在试图弄清楚这一点,但现在想我会在这里发布,看看我是否可以最终与我setInterval
了解这个问题。jQuery:在setInterval调用获取奇怪的错误...是我的语法错误?
在这种情况下,我在本文档中使用jQuery 1.4.4。
考虑以下几点:
var MS = {},
MS.timer = 1200; // this both would be user accessible by the plugin
// if the timer option is set then activate slideshow
if (MS.timer) { setInterval("go(2,'right')" , MS.timer); }
// show the slide (as defined by the pass ins)
function go(slideNumber, direction) {
if (!paused || !running) {
console.log('run!'+', '+slideNumber+' , '+direction);
}
}
然而,这导致:
go is not defined
这是 '正确' 正在记录每1200毫秒。那么如何运行我的功能go()
,包括传入slideNumber, direction
的值?
谢谢,这确实起作用。 – Jannis 2010-11-16 21:53:15