Jump to content

Function with passible id to GetElementById


Omirion

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.