Class 4 review (06/13/2002)


  1. See class 3 review, which was also a class #4 preview of this new material.

  2. Assignment #1 - Due Monday, June 17th by 6 p.m.

    • Page 61, Exercise #6 - Your Favorite Books Page. Please make up your own list. Turn in the printout of the HTML.
    • Page 191, Exercise #14. Turn in a printout of the HTML code with the embedded JavaScript statements.
    • Based on page 61, Exercise #6 above, develop the JavaScript that just randomly chooses one of the list of books and displays it on the page as the book you should read next or read something from that day. I will put an example of this up by Thursday afternoon. You will need to store the books in an ARRAY, so this requires you understand the lab class from yesterday, and the followup lecture.

  1. Hands on class on Friday in Wright 112 lab. We will do something with JavaScript arrays so you have some more experience with them. Probably use an array to create and output an OL or UL list of LI (List Items).

  2. You should read chapter #3 of the textbook. Page 61, Exercise #6 is a chapter 3 exercise. Lists are used all the time in HTML. The words you are reading right now are the 2nd LI of an OL list, right?

  3. Your array might be called myBooks. The statements to generate a randomly chosen book from your myBooks array would be:

    whichBook = Math.floor( Math.random() * myBooks.length );

  4. Study/review the lecture notes, handouts and all of the class summaries as you do this assignment. Treat an assignment like it is preparing for a test, if you want to be most effective and learn the most from this class. When you get an assignment, study over the previous weeks lectures and readings carefully. Develop a good understanding of all the material, but especially of what would apply to the current assignment. That is the BEST way to learn programming and ensure you are well prepared for tests or quizzes.

REVIEW OF LECTURE #4 and assignment #1 suggestions. New example handed out today that illustrates the document.referrer property, as well as the onLoad and onUnload event handlers, and creating a 2nd window.
     We modified the Wednesday code so that it speeds up by 1/5th of
     a second each time, until its going very fast, and then starts
     over at 2 second interval again.  The intervals are 2000 
     milliseconds, then 1800, then 1600, then 1400, then 1200, ...
     and finally 400 and 200.  Then it starts over at 2000.

     delayAmt = delayAmt - 200;
     if (delayAmt <= 0) {
        delayAmt = 2000;
     {

     Then we modified the original Wednesday program for changing
     bgColor and fgColor so that the time interval before the next
     change was  random, and 
                    anywhere between 50 milliseconds 
                                 and 3049 milliseconds.

     delayAmt = Math.floor( Math.random() * 3000 + 50 );

     changingBGcolors.html is currently pausing anywhere between
     1/20th second to 3.049 seconds, so go look at the URL again.  
See changingBGcolors.html from Wednesday lab class, but as modified to wait a random interval of time.