>>setinterval可以传递参数吗 ?
yes, but you cannot change the parameter per call, for example,
var alist = new Array("1","2","3");
function testArray(a)
{
alert(a.length);
}
setInterval("testArray(alist)",1000);>>如果一个function被其它frame同时调用是先调用先执行还是同时执行?
不是同时执行, the browser processes these calls in sequence>>执行的时候内部变量是不是互不干涉 ?
是互不干涉, unless you are using global variables and change them in the function
yes, but you cannot change the parameter per call, for example,
var alist = new Array("1","2","3");
function testArray(a)
{
alert(a.length);
}
setInterval("testArray(alist)",1000);>>如果一个function被其它frame同时调用是先调用先执行还是同时执行?
不是同时执行, the browser processes these calls in sequence>>执行的时候内部变量是不是互不干涉 ?
是互不干涉, unless you are using global variables and change them in the function
but in your code
alist is a global variable,how can I do like thisfunction testArray(a){ alert(a.length);}
function b()
{
var m=new Array;
m[0]=1;
setInterval("testArray(m)",1000);
}the brower alert m is undefined.
setInterval(eval("testArray(m)"),1000);
setTimeout(GetFunc([1,2,3,4,5]),1000);
function GetFunc(arr)
{
return func;
function func()
{
alert(arr);
}
}