HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 17. FORMS AND INPUTS 175


17.3 The input Tag


inputcovers most of the cases. It is a void tag. (No end tag is allowed.)


Exam Question 308(p.354): For eachtag in valid HTML5, is
a separate closing tag required, optional, or forbidden?
Required Answer:forbidden


Within the input tag category, there are many types. They are identified
by including a type attribute within the input tag.


<input type=xxx ...>is the tag for an input field.


The default type istext. That is also the type that is used if what you ask
for is not recognized by the browser.


We use ... to indicate that more attributes will be included in the input tag.


17.3.1 The value= Parameter


Thevalueparameter is used in every field.


The value parameter may or may not be openly displayed to the user, but
they can see it with a “show page source” command.


The value parameter may or may not be easily changed by your user.


Hackers always have the ability to change any parameter.


17.3.2 Button Inputs


Exam Question 309(p.354): List the four button type= attributes for
the input tag.
Required Answer:submit, reset, button, image


submitis the most typical input.


resetdoes not submit, but instead resets all input fields to their original
values.


buttongives you more capability to specify what should appear on the face
of the button.


imagelets you present an image. The exact place that the user clicks on
the image will be transmitted (x and y coordinates). The image acts as an

Free download pdf