theEclipse
Programmer
I am trying to set up a website that has dHTML animation when the page loads. The page loads, and the functions execute fine. Its in the timeout string that there is a problem. The function that actually moves the layer executes the first time, and then repeats with a timeout, but it quits after that with a javascript error that says something like "error, line 1, char 1, 'object' is undefined, code=0, src=c:\windows\desktop . . ."<br>
<br>
I am using Internet Explorer to do the basic coding, and I havn't even made the "flying" div's id/location a parameter yet, that comes later, after the basic codeing.<br>
<br>
<br>
here is the page:<br>
<br>
<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br>
<HTML><br>
<HEAD><br>
<TITLE>dHTML PlANEt, your source for CROSSbROWSER dHTML scripts!!</TITLE><br>
<script language="javascript"><br>
var timed<br>
function calculateSteps(div,endX,endY,numsteps){<br>
var stepX;<br>
var stepY;<br>
stepX=(endX-parseInt(document.all.PlanetAndMoon.style.left))/numsteps;<br>
stepY=(endY-parseInt(document.all.PlanetAndMoon.style.top))/numsteps;<br>
moveObjWithSteps(div,stepX,stepY,endX,endY);<br>
}<br>
function moveObjWithSteps(div,stepX,stepY,endX,endY){<br>
if((document.all.PlanetAndMoon.style.top!=endY)&&(document.all.PlanetAndMoon.style.left!=endY)){<br>
document.all.PlanetAndMoon.style.top=parseInt(document.all.PlanetAndMoon.style.top)+stepY;<br>
document.all.PlanetAndMoon.style.left=parseInt(document.all.PlanetAndMoon.style.left)+stepX;<br>
setTimeout('moveObjWithSteps('+div+','+stepX+','+stepY+','+endX+','+endY+')',25);<br>
}}<br>
</script><br>
</HEAD><br>
<body onload="calculateSteps('PlanetAndMoon',240,120,21);" background="images/background.gif" id=body><br>
<div id=PlanetAndMoon style="position:absolute; top:-10; left:-10; width:300; height:400;"><a href="#" onMouseOver="document.planet.src = 'images/bplanet2.gif'" onMouseOut="document.planet.src = 'images/planwmoon42.gif'" style="cursor:sw-resize;"><img src="images/planwmoon42.gif" name=planet border='0'></a></div><br>
</BODY><br>
</HTML><br>
<br>
Whatever help you can give is great,<br>
thankyou <p>theEclipse<br><a href=mailto: > </a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>
<br>
I am using Internet Explorer to do the basic coding, and I havn't even made the "flying" div's id/location a parameter yet, that comes later, after the basic codeing.<br>
<br>
<br>
here is the page:<br>
<br>
<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br>
<HTML><br>
<HEAD><br>
<TITLE>dHTML PlANEt, your source for CROSSbROWSER dHTML scripts!!</TITLE><br>
<script language="javascript"><br>
var timed<br>
function calculateSteps(div,endX,endY,numsteps){<br>
var stepX;<br>
var stepY;<br>
stepX=(endX-parseInt(document.all.PlanetAndMoon.style.left))/numsteps;<br>
stepY=(endY-parseInt(document.all.PlanetAndMoon.style.top))/numsteps;<br>
moveObjWithSteps(div,stepX,stepY,endX,endY);<br>
}<br>
function moveObjWithSteps(div,stepX,stepY,endX,endY){<br>
if((document.all.PlanetAndMoon.style.top!=endY)&&(document.all.PlanetAndMoon.style.left!=endY)){<br>
document.all.PlanetAndMoon.style.top=parseInt(document.all.PlanetAndMoon.style.top)+stepY;<br>
document.all.PlanetAndMoon.style.left=parseInt(document.all.PlanetAndMoon.style.left)+stepX;<br>
setTimeout('moveObjWithSteps('+div+','+stepX+','+stepY+','+endX+','+endY+')',25);<br>
}}<br>
</script><br>
</HEAD><br>
<body onload="calculateSteps('PlanetAndMoon',240,120,21);" background="images/background.gif" id=body><br>
<div id=PlanetAndMoon style="position:absolute; top:-10; left:-10; width:300; height:400;"><a href="#" onMouseOver="document.planet.src = 'images/bplanet2.gif'" onMouseOut="document.planet.src = 'images/planwmoon42.gif'" style="cursor:sw-resize;"><img src="images/planwmoon42.gif" name=planet border='0'></a></div><br>
</BODY><br>
</HTML><br>
<br>
Whatever help you can give is great,<br>
thankyou <p>theEclipse<br><a href=mailto: > </a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>