Omirion Posted February 13, 2010 Share Posted February 13, 2010 Hello, I'm trying to make a function that animates a given element by passing the elements id to it. Here is my code <script type="text/javascript"> var moo = 500; var foo = 0.0; function Change(a) { moo -= 5; foo += 0.008; if(moo <10) { document.getElementById(a).style.left = 0 +'px'; document.getElementById(a).style.opacity = 1.0; return } document.getElementById(a).style.left = moo +'px'; document.getElementById(a).style.opacity = foo; setTimeout(arguments.callee, 10) } </script> Any ideas on what i'm doing wrong? Quote Link to comment Share on other sites More sharing options...
yozyk Posted February 14, 2010 Share Posted February 14, 2010 setTimeout(arguments.callee, 10) You don't pass element id to Change function in this line. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.