function dr(){ var img = document.getElementById("img"); var MX = img.style.left; if (MX<936) { MX++; img.style.left = -MX +"px"; } if(MX>936){ MX--; img.style.left = MX +"px"; } var g = setTimeout("dr()",10); } window.onload = function(){ dr(); }
谁能明白其内在的原因,MX并没有因为setTimeout而自加到936或者自减到936.
相关分类