This code does not seem to run well: http://jsfiddle.net/5GEru/1/
var left = 0;
function mouvement(){
var bouger = document.getElementById("bouge");
bouger.style.left= left;
left++;
mouvement();
}
window.onload = mouvement();
The variable increments itself but somehow the left value does not get reapplied everytime the function is run. it remains at the initial 0.
What am I doing wrong?
Thanks for your tips guys!
You’re confusing the browser with invalid CSS. The browser is looking for a unit.
Try: