Скачать презентацию Java Script more arrays images Image Скачать презентацию Java Script more arrays images Image

adaafaefae9484088c86f50fdfd90ac7.ppt

  • Количество слайдов: 8

Java. Script – more arrays, images Java. Script – more arrays, images

allows us" src="https://present5.com/presentation/adaafaefae9484088c86f50fdfd90ac7/image-2.jpg" alt="Image Object and images[] array t Using allows us" /> Image Object and images[] array t Using allows us to display images on webpages. What if we want more control of what to show. t When a webpage with images is loaded by a browser, an images[] array is created. The first image is loaded onto images[0] and so on. t Unlike, GUI such as buttons etc, where they are the properties of the form, images are properties of the document. t In order to display an image using javascript. The command is straight forward as such. document. images[0]. src= "abc. gif"

Object Hierarchy for images Object Hierarchy for images

Medium exercise: jex 12. html Medium exercise: jex 12. html

Medium Exercise t Instead of 4 buttons, you only have one now. t When Medium Exercise t Instead of 4 buttons, you only have one now. t When you press the button, it will randomly select a picture t When you press random rotate, it will randomly pick a picture to display after a set interval t Stop random, will stop this process.

To get a function to repeat t The command to do that is stop. To get a function to repeat t The command to do that is stop. ID=set. Interval("f 1", 1000) t which means after every 1000 milliseconds, you will call function f 1() again. t In order to stop the animation, you do the following clear. Interval(stop. ID); t Where do you put this set. Interval and clear. Interval function?

How to include the rotation t You need to write two function and declare How to include the rotation t You need to write two function and declare a global variable. var stop. ID // together with other variables //declaration function rotate. Picture() { stop. ID = set. Interval("dis. First()", 500); } function rotate. Stop() { clear. Interval(stop. ID); }

Marquette Jackpot: jex 13. html t Create 3 random image t Stop the image Marquette Jackpot: jex 13. html t Create 3 random image t Stop the image from rotating t When you stop and the 3 images displayed are the same you alert “JACKPOT” t Good Luck t Hint: You might want to rotate slower initially to know you can stop in time to see you hit the jackpot.