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)';");
}
谁会 ,帮忙看看!

解决方案 »

  1.   


    setTimeOut("方法名",延迟毫秒数)
      

  2.   

    传的是函数
    setTimeout(function(){return function(){//setTimeout里怎么就执行最后一次循环啊,
    node.position=new Position(node.position.top,node.position.left);
    nodes[node.index]=node;
    createNode(node);
    canDragOfNode(node.index);//下面的方法
    }},5000);
      

  3.   


    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)';");
    }方法
      

  4.   

    自己放狗搜下, 网上有非常详细的setTimeout的用法 
    这里说也只能说个大概