The HTML Workshop

Javascript

Script Tags

The second and fourth lines of HTML comments are from the days of dealing with old browsers that ignore the <script>-tag, and would otherwise try to print out what's within those tags.

Functions

With Arguments

With No Arguments

With Returned Values

Anonymous Functions

Strings

Statements: Conditions

If-Else

For

For Through Properties of an Object

Forms

Running a function before submitting

Accessing form elements directly

Accessing form methods

Pre-written Functions

.length - Length of String or Number

.toString() - Convert number to string

Convert string to number

Concatenating a number to a string

Objects

Method vs. Property

object.method()
someObject.methodDoesThings() - Something happens when it's called (the method does something).
object.property
someObject.propertyIsValue - You get (or set) this value when it's called (the property is something - a number, string, boolean, etc.)

Initializing an Object

Adding and Defining Properties of an Object

Calling Methods of an Object

Object Check

It is a good idea to check whether the object exists in a given browser.

Object Check to Exit a Function

This

Associative Arrays (a.k.a. Hashes)

The array associates each key with a value.

For/in Statement

Go through all properties of the "person" object (i.e. go through all keys in the associative array "person")

Popups

Events

Inline Event Registration

Traditional Event Registration

Traditional Event Registration - Multiple

Advanced Event Registration

Mouse Events

Onmouseover - hovering over element

Onmouseout - hovering off of element

Onmousedown - holding click down

Onmouseup - releasing click button

Onclick = onmousedown + onmouseup

Onmousemove

window.status

In browsers like Firefox, this is disabled by default.

Offsets/Position

Getting and Setting Styles

Opacity

 
© 1999-2009. HTML Workshop. GordeonBleu. Gordon Mei. XHTML 1.1 | CSS 2.1.