it's an online class...and the prof doesn't include great examples...but thanks.
it's supposed to be a function swap () with two drop down menus to switch images...
these are the "directions" :
- Begin with an implementation of swap that looks like this:
- function swap ()
{
var indexA = 0;
alert(indexA);
}
- In between the two statements, put some code that stores
-
- 0 in indexA if "Upper Left" is selected in the first menu,
- 1 in indexA if "Upper Right" is selected in the first menu,
- 2 in indexA if "Lower Left" is selected in the first menu, or
- 3 in indexA if "Lower Right" is selected in the first menu.
- This code should deal only with indexA and the first menu; it shouldn't refer to the second menu or the images.
- When you've done this correctly, you'll see the correct value of indexA pop up when you select from the first menu and click "Swap". When it is working correctly, get rid of the alert().
-
- You've now written the first block of code. Write a second block of code that declares a variable indexB and stores
-
- 0 in indexB if "Upper Left" is selected in the second menu,
- 1 in indexB if "Upper Right" is selected in the second menu,
- 2 in indexB if "Lower Left" is selected in the second menu, or
- 3 in indexB if "Lower Right" is selected in the second menu.
- This code should deal only with indexB and the second menu; it shouldn't refer to the first menu or the images.
-
- Now your function is able to determine the indexes (indexA and indexB) of the two images (which are stored in the array document.images) that need to be swapped. The third block should be the code that actually swaps them. This code should deal only with indexA, indexB, and the images; it shouldn't refer to either menu.
...if this makes any sense to anyone?