you are here
Here’s a whole new input element we haven’t talked about. If
you need to send an entire ﬁle to a Web application, you’ll once
again use the
element, but this time set its type to
“ﬁle”. When you do that, the
element creates a control
that allows you to select a ﬁle and – when the form is submitted
– the contents of the ﬁle are sent with the rest of your form data
to the server. Remember, your Web application will need to
be expecting a ﬁle upload, and also note that you must use the
POST method to use this element.
element works just like the text
element, except that the text you type is masked. This
is useful for forms that require you to type in a password, a secret
code, or other sensitive information that you may not want other
people to see as you type. Keep in mind, however, that the
form data is not sent from the browser to the Web application
in a secure way, unless you make it secure. For more on security,
contact your hosting company.
This isn’t a new element, but a new way to use an element you
already know. If you add the attribute
with a value
of “multiple” to your
element, you turn your single
choice menu into a multiple choice menu. Instead of a pop-
down menu, you’ll get a multiple choice menu that shows all
the options on the screen (with a scrollbar if there are a lot of
them); you can choose more than one by holding down the Ctrl
(Windows) or Command (Mac) key as you select.
type=”password” name=”secret” />
<select name=”characters” multiple=”multiple”>
<option value=”Buckaroo”>Buckaroo Banzai</option>
<option value=”Tommy”>Perfect Tommy</option>
<option value=”Penny Priddy”>Penny</option>
<option value=”New Jersey”>Jersey</option>
<option value=”John Parker”>John</option>
type=”ﬁle” name=”doc” />
The password <input> element works
exactly like the text <input> element,
except the text you type is masked.
Here’s what the file input
element looks like in a couple
of different browsers.
To create a file input element, just set the
type of the <input> element to “file”.
Just add the attribute
multiple with a value of
“multiple” to turn a single
selection menu into a multiple
can choose more
than one option
at a time.