Lecture notes - April 10
- Caveat on what I said last time:
"document.bgColor=..." must be invoked after the <body>
tag, so that the "document" actually exists. In other words,
as a general rule put only function and variable definitions
in the <head>, not things that change the DOM objects.
(An even better way to make sure things change after the whole
page loads is with the <body "onload=init()"> .
- Today: chapter 14 - more stuff to put in forms.
- For all these examples, to see the code go to
- The "hidden" values in there are actually a bad idea
in general. There's little to stop someone from copying
the page, changing the numbers, and submitting their own
copy with whatever prices they want...
- arrays - a collection of N things numbered 0 to (N-1)
Here are two ways to print such a collection, explicitly
or using a loop. (We'll talk more about loops later.)
- radio buttons
- pop-up menu
This stuff is complicated, and picky about its syntax.
So don't try to remember it all; look up the syntax you need
and copy examples from my notes or the text, adopting them
as need be.
- A single form can mix and match all of these elements,
including the text blocks we did last time.
Different buttons within the forms can launch various
different functions, so there's lots of things you can
do with these pieces.
- So there you are. See you next week.