Chapter 15. JavaScript 4: Objects and Arrays Table of Contents


Activity 3: Animation using an array of Image objects



Download 0.78 Mb.
View original pdf
Page16/16
Date04.04.2022
Size0.78 Mb.
#58550
1   ...   8   9   10   11   12   13   14   15   16
chp15
Activity 3: Animation using an array of Image objects

Create a Web page that shows an image, and when the mouse goes over this image the image is replaced with an


11 animation of 3 other images before returning back to the original image. Make the original image silence.gif, with browser output as follows Make the three images that are animated taptap.gif, knockknock.gif and BANGBANG.gif, with browser outputs as follows


12 Create an array of Image objects called images. You only need to refer to the src property as in the following lines
// setup image array images = new Image images[0].src = "taptap.gif"; In the body section of the HTML file display the silence image (naming it noise) with an appropriate
onMouseOver JavaScript one-liner:

IMG NAME="noise" SRC="silence.gif" onMouseOver="startAnimation()">


Download 0.78 Mb.

Share with your friends:
1   ...   8   9   10   11   12   13   14   15   16




The database is protected by copyright ©ininet.org 2024
send message

    Main page