Changes

Building Forms with JavaScript

1 byte removed, 18:28, 15 May 2007
The JavaScript Text Object
Now that we have covered the basics of the JavaScript Form Object it is time to look at the objects we can place into the Form container to interact with the user. The most common of these objects is the ''Text'' object. The Text object places a single line text field into tyhe form into which the user can type information (such a name, address or telephone number).
The syntax for creating a text object withion within a Form is as follows:
<input type="TEXT" name="''objectname''" value="''current value''" size="30" ''event handling''>
''event handling'' specifies what action to take when a particular event on the object is triggered. Events that can be triggered by the Text object are:
* '''onFocus''' - triggered when the text field gains focus (typlically typically when thge the cursor is moved into the field to begin typing).
* '''onBlur''' - triggered when the text field loses focus (typically when the user clicks somewhere outsite the text area).
* '''onChange''' - triggered when the contents of the text area is changed by the user and focus is lost.
* '''onSelect''' - triggered when the user highlights text in the text field.