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? Link to comment https://forums.phpfreaks.com/topic/191976-function-with-passible-id-to-getelementbyid/ 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. Link to comment https://forums.phpfreaks.com/topic/191976-function-with-passible-id-to-getelementbyid/#findComment-1012010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.