I. Working with Forms. Web forms can involve the interplay of three different code structures to present an "interactive" format recognized by users:
We will explore in this section the third of those three -- the JavaScript used for code validation. We will work with the form, and so you will see the HTML underlying the code, but we will not spend time explaining how to set up HTML forms. Neither shall we discuss in detail the CGI/Perl Script code which might be used to capture, store, and process the information involved.
So, let's set up a form and see how it the information typed in by the client could be validated prior to submission by client-side JavaScript inserted in the form.
II. Conditions.
Conditions are "if...then...else statements, which test whether a condition is true or false, or whether a property has a certain value. See the following discussion of conditions, and view many of the codes we have studied.
III. Loops.
Loops scroll through a set of related information (or an Array) using a
IV. Formatting Text.
Formatting text can be done inside the paramter parentheses () of the write method. You simply "write" the standard HTML tags you want to surround the statements. See the Conditions sample code above. This can also be done to format photographs, which we'll discuss next week. But, if you want, you can look ahead to the slide show coding on my web site athttp://www.cocanal.com.
See the discussion of concatenation in the Javascript basics essay.