Java Reference
In-Depth Information
Form Controls
In our previous search example we only used the input and button form controls, but there
are others that can help to make our web pages more interactive.
The different types of form controls are:
•
input
fields, including text, passwords, check boxes, radio buttons, and file up-
loads
•
select
menus for drop-down lists of options
•
textarea
for longer text entry
•
button
for submitting and resetting forms
To demonstrate all of these HTML form controls, we'll create another form that contains all
erties associated with the Man of Steel. We're going to create a form that allows a user to
enter all these details into a browser, so we'll create a similar
hero
object that describes a
superhero (or villain).
Create a new project folder that contains the following code in a file called hero.htm:
hero.htm
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hero Form</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<form id="hero">
<label for="name" class="break">Name:</label>
<input type="text" name="name" autofocus placeholder=
↵
"Your Super Hero Name" maxlength=5>
