setTimeout

setTimeout尽量使用:

setTimeout(function(){},1000);这种格式;即使是一个方法也放进大括号里面去,那样不容易报错,可以使用的变量(如参数传递等)。

function refresh_move(tag){
 tag.style.top = '1px';
 tag.style.left = '1px';
 setTimeout(function(){tag.style.top = '0px';tag.style.left = '0px';}, 100);
}

 

posted @ 2013-03-04 14:26  残星  阅读(549)  评论(0编辑  收藏  举报