Text ElementNameText Element---a graphical text input fieldAvailabilityNavigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0 Synopsis
form.name form.elements[i] Properties
Methods
Event Handlers
HTML SyntaxA Text element is created with a standard HTML <INPUT> tag, with the addition of optional attributes for event handlers:
<FORM> ... <INPUT TYPE="text" specifies that this is a Text element [ NAME="name" ] a name that can later be used to refer to this element specifies the name property [ VALUE="default" ] the default value transmitted when the form is submitted specifies the defaultValue property [ SIZE=integer ] how many characters wide the element is [ MAXLENGTH=integer ] max allowed number of input characters [ onBlur="handler" ] the onblur() event handler [ onChange="handler" ] the onchange() event handler [ onFocus="handler" ] the onfocus() event handler > ... </FORM> DescriptionThe Text element represents a text input field in a form. The SIZE attribute specifies the width, in characters, of the input field as it appears on the screen, and the MAXLENGTH attribute specifies the maximum number of characters the user will be allowed to enter. Besides these HTML attributes, value is the main property of interest for the Text element. You can read this property to obtain the user's input, or you can set it to display arbitrary (unformatted) text in the input field. UsageUse the Password element instead of the Text element when the value you are asking the user to enter is sensitive information, such as a password that should not be displayed openly on the screen. Use a Textarea element to allow the user to enter multiple lines of text. When a form contains only one Text or Password element, the form will automatically be submitted if the user strikes the Return key in that Text or Password element. In many forms, this is a useful shortcut. In some, however, it can be confusing if the user strikes Return and submits the form before entering input into other form elements such as Checkboxes and Radio buttons. You can sometimes minimize this confusion by placing Text elements with their default submission action at the bottom of the form. |
|