HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 17. FORMS AND INPUTS 177


Thenameparameter is normal.


Thevalueparameter will be displayed to the user and can be easily changed
by them.


Other useful parameters are: size, maxlength, and pattern.


Thesizeparameter specifies how big the text field should be. It is the
number of characters that should be visible. In my experience, you can
usually see more than that. For size=1, you can probably see two or three
characters. This may vary by browser.


CSS can be used to make the text field the particular size you want.


Themaxlengthparameter specifies how many characters will be accepted.
If you set maxlength=5 and they try typing in 6 characters, only the first 5
will appear.


Thepatternparameter specifies a regular expression that must be obeyed.
See Section 17.7.1 (page 182) for more on regular expressions.


type=password


<input type=password ...>is the tag for a password field. It acts almost
exactly like a text field, but it obscures the thing typed in, replacing each
character with a dot or other symbol. It provides one line of space for the
user to type in something.


The most important parameters are: name, size.


Thenameparameter is normal.


Thesizeparameter specifies how big the text field should be. It is the
number of characters that should be visible. In my experience, you can
usually see more than that. For size=1, you can probably see two or three
characters. This may vary by browser.


Other useful parameters are: value.


Thevalueparameter will be displayed to the user as a series of dots and
can be easily changed by them. If your user is a hacker, they can see the
value in that field.

Free download pdf