Review 4
print
(last updated:
Jul 25, 2009)
print
The coverage from the class notes is the material in Notes
14
and
15.
You also need to be able to create style rules when provided with
the style properties/values.
Additional practice problems:
Problem 1, Problem 2, Problem 3, Problem 4, Problem 5
Advanced problems:
Problem 6
The following steps are done consistently to solve these problems:
-
Create the document's initial appearance first.
If necessary, create a style region in the document's head.
- Create a script region also in the document's head.
If there is a style region, position the
script region below the style region.
- Create function calls for JavaScript events:
- for hyperlinks (a elements),
use the javascript: prefix in the href attribute;
- for buttons, use the onclick attribute;
onclick may also apply to checkboxes and radio buttons.
- for rollover, use the onmouseover & onmouseout
attributes
- for other effects, use the appropriate JavaScript attribute
(for example, onchange)
- Create empty functions within the script region
corresponding to the function call(s) used in the HTML elements.
- Create id attributes for all the HTML elements which you want
to access by the JavaScript functions.
-
Write the JavaScript code to effect the desired behavior using
objects obtained by the document.getElementById function.
Manipulate the objects via these properties:
- elt.src (images)
- elt.innerHTML (contents of elements between
start and end tags)
- elt.style.property (style properties)
- elt.value (textfields and selection lists)
- elt.checked (radio/checkbox elements)
© Robert M. Kline