Genie: Animation vor Ablauf der Zeit per onclick starten

Beitrag lesen

Hi

Ungetestet:

  
var pixel = 48;  
var gestartet = false;  
function startAnimation()  
{  
 if(!gestartet)  
 {  
  animation = window.setInterval("animation()", 20);  
  gestartet = true;  
 }  
}  
  
function animation()  
{  
 var elem = document.getElementById("ani").style;  
 elem.height = pixel + "px";  
 pixel = pixel + 1;  
 if ( pixel == 232 ) {  
 clearInterval(animation);  
 }  
}  
  
window.onload = function() { neu = window.setTimeout("startAnimation()", 10000) }; 

[/code]

  
<a href="" onclick="startAnimation()">Klick</a>

mfg
Genie