
 |
| Corresponding text on pages 5-8. |
In order to write the script portion of the code, you need to become familiar with the following terms. You will probably not memorize what each of these is, but this is a concise summary of the major terms in Javascript. You will need to return to this list often. These terms define portions of a script:- Statement- a portion of the script that defines one task or job.
Ex. function showzero(invalue) {if (invalue>9) return :"0"+invalue} - Object- the parts of a webpage that Javascript can manipulate on the viewers screen. (ie. document(whole webpage),windows, forms, elements in forms, etc.) As you can see from the examples, objects can have sub-objects. For example, elements in a form(like a button) are sub-objects of the object, a form.
- Properties- qualities of an object. Could also be considered "sub-objects". So for example, a form has a property of a button. But the button also could have a property like the text printed on it.
- Methods- actions assigned to an object or sub-object. Methods are always followed by parentheses(). The parentheses can be empty or contain a "string" of words and letters.
- Dot Syntax- standard way of expressing the above parts of a Javascript. Dot syntax always starts from the larger object down to the smaller object. Sometimes(often) the dot syntax ends with a method. Examples:(objects are in red, sub-objects or properties are in green, and methods are in blue)
- document.write()
- document.window.location
- form.checkbox.reset()
- Events- actions of your user like moving a mouse or clicking a button.
- Event Handlers- commands that tell the browser what to do when a user creates an event.(ex. onmouseover, onload, etc.)
- Variables- are Javascript statements that usually start with the 3 letters var as in this example: var nameyougiveit="x+3". Variables can also be written without the var, so this example could also be written nameyougiveit="x+3". I recommend you always write the var part to help you remember that this is a variable. In a sense, a variable is a name you assign to a value(like x+3). The value(see below) does not, however, have to be numbers nor does it have to be a set value.
- Value- usually a number or equation or a string(see below)
- Operators- in math, the =,>,<, etc. symbols. Same thing in Javascript. These are the three most common in Javascript, but look at tables 1.3, 1.4, 1.5 on pages 8-9 for a full listing.(Note: assignments and comparisons are just types of operators. They are all used in a var statement.)
- String- word or words in quotes. Ex. "Park Center High School"
- Function- very important term! You create functions in your script. You give it a name and assign it statements all in the <head> portion of the html document. You then "call" the function by it's name later on to use it. In the example below, I have named the function "namefunction". In the quotes after this name, you list any variables you are going to use in this function. If you are using no variables, you must put empty (). In between the wiggly brackets, you list all of your statements of the function.
Ex. of function:
function namefunction()
{
put statements here
}
At this point, before you do Exercise Terminology, I am going to ask you to spend 10 minutes(no more,no less!!!) looking at our Javascript Quick Reference Page. Memorize it all in 10 minutes(just kidding). Play around with it to see how it is set up and look at a few explanations of how JavaScript is written(click on the links at the top of the page). This Quick Reference Page will be a main source of info for you as you start to write your scripts tomorrow.
>>Start Scripting
Index
Grading
Schedule
Photoshop
Styles
Resources
Exercises
Links