Java. Script – more arrays, images
Object Hierarchy for images
Medium exercise: jex 12. html
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. 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 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 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.