Click to See Complete Forum and Search --> : need help with "fly-in" animation mozilla web page


anotherjohn
01-01-2006, 01:33 PM
Hi, I'm building a web page. I'm trying to get a spider to "fly-in" from the top right corner. Can anyone point me to a script and tell me how to put it in?

some one told me it also has to be compatible for people viewing the page in other browsers.

when I take java script and put it in "frount page" it works, however my web page has already been done in Mozilla. when i put the code in mozilla:

"<body onload= "hdynAnimation()"> it won't keep it, it just changes it back to

</body>

thankyou

p.s. I dont know what I'm doing, but some how, so far I've pulled the web page together. any detailed reply would be very much apreciated. I'm new to this. thanks again.

sanfordonyx
01-01-2006, 02:06 PM
I do not know about frontpage, but maybe you have to set the onload property of your body through the frontpage. That way it does not keep changing your code back to what it thinks you want.

I would absolutely position your spider, then animate its top and left to get it to move.

function moveSpider() {
var spider = document.getElementById("spider");
alert(spider.style.top);
spider.style.top = parseInt(spider.style.top) + 10 + "px";
spider.style.left = parseInt(spider.style.left) + 10 + "px";
setTimeout("moveSpider()", 1000);
}


See the way the javascript can access the element's top and left through the style? To move it faster, decrease the 1000 in the timeout. What you need is an image with an id of "spider" for this.
Hope this helps some.

anotherjohn
01-02-2006, 11:48 PM
Thanks for your help