This is a silly little script I found at www.rewriteables.net that was originally written for Netscape 4 and IE4/5. In modifying it to work with modern browsers and SiteSpinner, I learned how to make a copy of an existing image via javascript and that Firefox and IE handle browser events differently. I have decided to post my experiment just in case you might need to do something like this for one of your projects.
To use the script, you will need to place an image on your page. You can save the ball.gif image from the demo page if you do not have a suitable image. Any image will work; it does not have to be a ball. When you add the image, make note of the geometry name as it will be needed to configure the script.
Place the following code in a custom header:
The last line on the above code (<body onLoad=”bounceInit(‘geo-name’);” >) starts the script when the page is loaded in the browser. You will need to replace the parameter geo-name in this line to the actual geometry name of your image. This name is used by the script to locate your image and make a copy that will be used as the bouncing image.
The last line of the bounceInit() function (document.onmouseup = buttonUp;) hooks the mouse ommouseup event to the browser document (or page) so that it will execute the buttonUp() function when the browser detects a mouse button release (left or right)anywhere on the page. This can be changed to another event type, such as an onmouse down (document.onmousedown) or onclick (document.onclick) event.
Contact the LowTechGeezer
VM User's Forum
Bruceee's Sandpit
Webmaster's Corner
Other Useful Sites