next up previous contents
Next: Password Up: Entering Data Previous: The Submit Button

Text Input

A text input is simply a box in which anything can be typed -- letters, numbers, or anything else -- via the keyboard. In most browsers, the box is twenty characters wide, but this can vary.

Simply set the type attribute of the input tag to get a text input box:

<INPUT type="text">

which would result result in:

The SIZE attribute can be used to fix the width of the displayed box:

<INPUT type="text" size=9>

which would result result in:

You can limit the number of characters which may be input by using the MAXLENGTH attribute. The value of MAXLENGTH is expressed as a number of characters, just as SIZE is. For Example:

<INPUT type="text" name="socsec" size=9 maxlength=9>

which creates an input field nine characters wide into which no more than nine characters may be input.

or

<INPUT type="text" name="socsec" size=9 maxlength=11>

which creates an input field is still nine characters wide, but the user can enter up to eleven characters.



dave@cs.cf.ac.uk