Jens: Xhtml Javascript Firefox || IE

Beitrag lesen

Hilfe! Hab mir schon die Finger wund gegooglet.

Hier meine XHTML Datei------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" language="javascript" src="test.js"></script>

<title>TEST</title>
</head>
<body onload="startA()">

<div id="n1" style="position:absolute;left:595px; padding-left:5px; font-family:Verdana;font-size:10px; top:0px;">TEST1</div>

<div id="n2" style="position:absolute;left:595px; padding-left:5px; font-family:Verdana;font-size:10px; top:0px;">TEST2</div>

<div id="n3" style="position:absolute;left:595px; padding-left:5px; font-family:Verdana;font-size:10px; top:0px;">TEST3</div>

</body>
</html>

Hier meine JS-DATEI:------------------------------------------------

var a1, a2, a3, name;
var y1=1,i=1,y2=30,x=1,ende=3;

function bewegung1()
{
  if(x>ende)
  x=1;
  name="n"+x;
  document.getElementById(name).style.top=y1;
  y1++;
  if (y1 > 30)
  {
    window.clearInterval(a1);
    a2 = window.setInterval("warten()", 500);
  }
}

function warten()
{
  i++;
  if (i > 9)
  {
    window.clearInterval(a2);
    a3 = window.setInterval("bewegung2()", 50);
  }
}

function bewegung2()
{
  name="n"+x;
  document.getElementById(name).style.top=y2;
  y2++;
  if (y2 > 60)
  {
    window.clearInterval(a3);
    y1=1;
    i=1;
    y2=30;
    x++;
    a1 = window.setInterval("bewegung1()", 50);
  }
}

function startA()
{
a1 = window.setInterval("bewegung1()", 50);
return 0;
}

Im IE funktioniert es! Im Firefox nicht. Wenn ich die XHTML Definition rausnehme funktioniert es. Sonst nicht. Was mache ich falsch?

Mit freundlichen Grüßen Jens