witam
chce zrobic poruszanie sie dwoch elementow na tablicy ale jest jakis blad i nie moge go znalezc
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<script >
function animacja()
{
var tab=new Array();
tab[0]=Array("anim",100,200,1,0);
tab[1]=Array("anim1",300,100,1,0);
for(i=0;i<=tab.length;i++)
{
if(tab[4]==0) tab[1]++;
else tab[1]--;
if(tab[3]==1) tab[2]++;
else tab[2]--;
if(tab[1]<=0) tab[4]=0
else if(tab[1]>=document.body.offsetHeight)
tab[4]=1;
if(tab[2]<=0) tab[3]=1;
else if(tab[2]>=document.body.offsetWidth)
tab[3]=0;
}document.getElementById('anim').style.left=tab[1];
document.getElementById('anim').style.top=tab[2];
document.getElementById('anim1').style.left=tab[1];
document.getElementById('anim1').style.top=tab[2]
setTimeout("animacja()",5,"javascript");}
</script>
<style >
#anim
{
position:absolute;
left:0px;
top:0px;
}
#anim1{
position:absolute;
right:300px;
top:0px;
}
</style>
</head>
<body onload="animacja()">
<img id="anim" src="ball.gif" >
<img id="anim1" src="ball1.gif" >
</body>
</html>