Das Problem ist dass der script verursacht, dass der Browser nicht mit dem Laden der Website vorran kommt:
HTML
<html>
<head>
<title>the animation</title>
<script language="JavaScript">
<!--
theanimation=1;
function startanimation (){
imge='<img src="' + theanimation + '.jpg" />';
document.write(imge);
if (theanimation<21) {
timer=setTimeout("startanimation()", 1000);
theanimation++;
}else {
clearTimeout(timer);
timer=null;
}
}
//-->
</script>
</head>
<body>
<input type="button" value="Klick mich" OnClick="startanimation()" />
</body>
</html>
Alles anzeigen