5.1 Javascript Execution Environment: Window
5.1 Javascript Execution Environment: Window
1. DOM address
document.forms[0].elements[0]
- Example:
document.myForm.pushMe
- Example:
document.getElementById("pushMe")
<form id = "topGroup">
<input type = "checkbox" name = "toppings"
value = "olives" />
...
<input type = "checkbox" name = "toppings"
value = "tomatoes" />
</form>
...
var numChecked = 0;
var dom = document.getElementById("topGroup");
for index = 0; index < dom.toppings.length;
index++)
if (dom.toppings[index].checked]
numChecked++;
- Radio buttons
2. Internet time
- Event propagation
- Three parameters:
node.addEventListener(
"change", chkName, false);
Default value for height and width are 150 and 300
pixels
-
- The id attribute is required if something will be
drawn
if (myCanvas.getContext) {
var context = myCanvas.getContext(‘2d’);
// Drawing code
}
SHOW rects.js
SHOW parallel.js