function moveElemet(tarElemet,position){
var count = parseInt(tarElemet.style.marginLeft);
if (count < position){ // on the left, move right
count+=1;
alert(count);
tarElemet.style.marginLeft=count+"px";
setTimeout ( moveElemet( tarElemet,position) ,1000);
}
就是把tarElemet往右移动,用settimeout的1000ms延迟做出动画效果,但是它却是瞬间把marginLeft值改变成position值了,是忽略了settimeout的delay属性吗?求高手指教!!!!!!!!!!