js setTimeout问题

lx_12345678 2011-12-07 12:29:56
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)';");
}
谁会 ,帮忙看看!
...全文
181 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yj1300918200 2011-12-07
  • 打赏
  • 举报
回复
settimeout()破东西
yj1300918200 2011-12-07
  • 打赏
  • 举报
回复

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)';");
}方法
yj1300918200 2011-12-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 andyalex 的回复:]
传的是函数
setTimeout(function(){return function(){//setTimeout里怎么就执行最后一次循环啊,
node.position=new Position(node.position.top,node.position.left);
nodes[node.index]=node;
createNode(node);
canDragOfNode(……
[/Quote]
是方法
andyalex 2011-12-07
  • 打赏
  • 举报
回复
传的是函数
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);
hinada99 2011-12-07
  • 打赏
  • 举报
回复
mixIn是什么方法?
hinada99 2011-12-07
  • 打赏
  • 举报
回复

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


汉尼拔 2011-12-07
  • 打赏
  • 举报
回复
自己放狗搜下, 网上有非常详细的setTimeout的用法
这里说也只能说个大概
lx_12345678 2011-12-07
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hinada99 的回复:]
JScript code


setTimeOut("方法名",延迟毫秒数)
[/Quote]
不用看那个

87,989

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧