js setTimeout问题
function doLoadFlow(str){
nodes=new Array();
lines=new Array();
eval(str);
for(var i=0;nn!=null&&i<nn.length;i++){
var node=new Node();
node=mixIn(nn[i],node);
node.type=typeToNum(node.type);
setTimeout((function(node){return function(){//setTimeout里怎么就执行最后一次循环啊,
node.position=new Position(node.position.top,node.position.left);
nodes[node.index]=node;
createNode(node);
canDragOfNode(node.index);//下面的方法
}})(node),5000);
}
}
function canDragOfNode(index){
if(index!=null){
eval("$('node"+index+"').style.behavior='url(../htc/sndrag.htc)';");//这样写有问题吗,提示这缺少对象
return;
}
var i;
for(i=0;i<nodes.length;i++)
eval("$('node"+i+"').style.behavior='url(../htc/sndrag.htc)';");
}
谁会 ,帮忙看看!