34,333
edits
Changes
→The JavaScript Text and TextArea Object
</pre>
== The JavaScript Text and TextArea 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 a Form is as follows:
<input type="TEXT" name="''objectname''" value="''current value''" size="30"''event handling''>
* '''type''' - specifies that the type of object is a TEXT object.
* '''size''' - specifies the maximum number of characters that can be entered into the Text field.
* ''event handling'' - specifies what action to take when a particalr 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 when thge 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.