RysChwith
03-28-2005, 04:03 PM
So, I thought it'd be fun to try OOP with JavaScript. Since I was in the process of reworking a slideshow script I've been using at work, it seemed a likely test subject.
The script is designed to work by replacing element contents based on their IDs. So, for example, when you go to slide 5, it goes through an array that tells the script which elements gets replaced, then puts in the information from array index 4 for each of those elements. The procedural version works. The OOP... well, not so much. As near as I can tell, the two classes involved are erroring out immediately, and the main page is erroring out in the nested for loop. I've attached what I have so far as a zip file. Oop.htm is the main page, controller.js is the class for the slide show controller, and slideItem.js is the class for an element of the slide show.
If anyone feels inclined to take a peek through what I've done so far and offer advice, I'd be appreciative.
Rys
The script is designed to work by replacing element contents based on their IDs. So, for example, when you go to slide 5, it goes through an array that tells the script which elements gets replaced, then puts in the information from array index 4 for each of those elements. The procedural version works. The OOP... well, not so much. As near as I can tell, the two classes involved are erroring out immediately, and the main page is erroring out in the nested for loop. I've attached what I have so far as a zip file. Oop.htm is the main page, controller.js is the class for the slide show controller, and slideItem.js is the class for an element of the slide show.
If anyone feels inclined to take a peek through what I've done so far and offer advice, I'd be appreciative.
Rys