Thursday, 5 September 2013

Can I pause for cycle 500mil sec in javascript?

Can I pause for cycle 500mil sec in javascript?

I have this function to move an object and I want to set an interval of
500 mil secs on my cycle. No jQuery, just javascript. I have try
setInterval('',500)
function shot() {
document.getElementById('power').play();
for (var i=140; i<400; i++)
{
document.getElementById('shot').style.visibility='visible';
imgShot.style.left = parseInt(imgObj.style.left) - 130 + 'px';
imgShot.style.top = parseInt(imgObj.style.top) - i + 'px';
setInterval('',500);
}
}

No comments:

Post a Comment