marco: Scriptfehler - Object erwartet - warum?

Beitrag lesen

Hallo zusammen.

Ich habe hier ein Script. Es bringt mir immer eine Fehlermeldung. Objekt erwartet. Und ich weiß nicht warum. Kann mir jemand helfen?

<script language="JavaScript">
function moveLayer()
{
 if(typeof(document.all) == 'object')
 {
  a = document.all.lay1.style.left;
  a = parseInt(a.substr(0,a.search('px')))+1;
  document.all.lay1.style.left = a+'px';
  if(a <= 500){window.setTimeout('moveLayer()',100);}
 }
 if(typeof(document.getElementById('lay1')) == 'object' &&
   typeof(document.all) != 'object')
 {
  a = document.getElementById('lay1').style.left;
  a = parseInt(a.substr(0,a.search('px')))+1;
  document.getElementById('lay1').style.left = a+'px';
  if(a <= 500){window.setTimeout('moveLayer()',100);}
 }
 if(typeof(document.lay1) == 'object')
 {
  document.lay1.left++;
  if(document.lay1.left <= 500){window.setTimeout('moveLayer()',100);}
 }
 if(typeof(window.opera) == 'object')
 {
  document.all.lay1.style.left++;
  if(document.all.lay1.style.left <= 500){window.setTimeout('moveLayer()',100);}
 }
}
</script>