Class of HTML Group 1 : Java Script

Teachers : Gus Goldsmith and Robert Johnston.
Senior Center. Charlottesville VA.

Feb18-03

Lesson One.

The JavaScript class (group1) had been going on for a while, till it merged with our Html class group 2; We are like 6 or 7 months behind so we decided that we would ask for a "come back" to review everything we have learned so far. Here is the first lesson with Gus and Robert during which we had the chance to voice our concerns to Robert over several matters we didn't understand in the past. I have tried to record most of the answers in the following notes. I hope I could continue doing this in a series the way I did with the Html class last year.

Review:

1- Gus started with the html protocol at the beginning of a source code page: He insisted that we kept the good habit of separating the <html> and the <head > tags from the <title> tag.

2- We learned that if the comment tag <!-- --> should happen in between the <head> and </head> it could happen also in the html <body> part of the document where html begins to interact with JS . In such case one must repeat the change to JS <Script="JavaScript"> again. Jenny asked a question on "comments with the double slash // comment. The question was :"Would the double slashes used only when there is more than oneline of comments?" Gus's answer was that one had to use always the double-slash // at the beginning of any comment line.

3- Gus projected a slide show Scripts with Arrays and we came up with many questions:

a- The slide show displayed a picture when the function was called and the command was executed by the event handler OnMouseOver.
On the OnMouseOut command, it showed a blank frame. Gus asked why? Jenny said it's because the OnMouseOut pointed to a source that was "blank.jpg". If we subtituted the blank.jpg by anything estranged to the browser like an "X", it would just ignore it, and would hold on to the last picture till the MouseOver came back for the next one. Robert explained further that we could eliminate the MouseOut part all together. It followed the same logics: MouseOver =picture came; MouseOut=picture stayed the same. MouseOver again= the next picture showed. Gus asked whether we could make it show another picture when the Mouse was moved away from the picture; Answer: Yes, we could. Just change the course of the OnMouseOut path to another command similar to the OnMouseOver path/source.
For a sample of the above scripts, see Jenny's Slide Show #2 or click here

b- Robert explained the advantage to use Arrays in a slide show : it saved time and space to repeat the same command each time a new picture was needed to appear in the loop. He also mentioned that one could start with any number at all provided that one kept a continuation of consecutive numbers in the list.

c- The next question was about the 3 different kinds of "brackets" used in scripts: The round one, the curled one and the straight one. There was no explanation on "why and why not". Robert said it has been programmed and used for many years; It has been working for everybody since, we just had to continue to use them without concern. Here is what I made out of the answers Robert gave:

4 - Gus raised the pros and cons about using semi-colons " ; ". We all agreed that semi-colons are "a must" to use at the end of each statement, before we could go to another line. We wouldn't have to use a semi-colon after the function's name though. If I miss anymore info on this topic please let me know so I can update this page soon.

5- Margie wanted to know about the graphics that we listed in the pre-downloading part. Robert said it was necessary to have the pictures and your html script document in one directory. Gus added that we should make a big folder and name it "My pictures" or something like that then put all the pictures we use for the class in there, together with the scripts that use them. Let's keep the paths to the pictures simple, short and easy to remember.

This is the end of Lesson One.

Back to the top

Comments by Jenny

Robert mentioned the new lesson he was going to teach us next week. I was the one who protested and I saw that Margie was giving me an approval nod. This is my problem: I started this class with Robert in December last year (3 months) and I am having a pile of different scripts, none of them is totally practiced on, done with, digested, understood . If I show some of my homework in class taylor-made and clear-cut done, that is only because I copy-pasted the code.

Today is the first time I had a class that I could bring home some tangible results and could write it down in notes, the same way I did with the HTML class. I wish Robert and Gus would take this into consideration and don't mind working with us rather than over us. My sincere thanks to all.

Jenny

____________________________________________________________________________________

ŠJenny 2003