In order to become a better JavaScript programmer, you need to
understand the basics of Javascript. The last installment of Javascript
Basics will go over arrays and events. These topics are fairly easy and
should not require too much work.
Arrays
Arrays allow you to ceate variables that are somewhat similar. For example, say you have a set of variables like the list below:
|
spoono1 = .5; spoono2 = 1; spoono3 = 1.5; spoono4 = 2; 95 more elements... spoono100 = 50; |
|
spoono = new Array for (x = 1; x <= 100; x = x +1); { spoono[x] = x/2}; This creates the array and individual variables can be called up using the following example syntax: spoono[50] = 25; |
Events tell Javascript when to be activated. For example in the Alerts Tutorial we had the alert box popup when the user clicked on a button. We used the onClick event so that an alert came up when the user clicked a button. So, here is a list of some other events and their uses in HTML coding:
| Event | Function | HTML Use |
| onMouseOver | Activates Javascript when a user rolls his mouse over an object. | Used in links tags and used for animated buttons. |
| onMouseOut | Activates Javascript when a user rolls his mouse off of an object. | Used in links tags and used for animated buttons. |
| onClick | Activates Javascript when a user clicks something. | Used in links tags and forms (buttons, form fields, etc.) |
| onSubmit | Activates Javascript when a user presses the Submit button. | Used in forms. |
| onLoad | Activates Javascript when a page finishes loading. | Used in the body tag. |
| onUnload | Activates Javascript when a user leaves a page. | Used in the body tag. |





