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-
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
these elements. Back in Chapter 5 , we created a superman object that had lots of prop-
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:
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Hero Form</title>
<link rel="stylesheet" href="css/styles.css">
<form id="hero">
<label for="name" class="break">Name:</label>
<input type="text" name="name" autofocus placeholder=
"Your Super Hero Name" maxlength=5>
Search WWH ::

Custom Search