Example |
<html> |
|
<head> |
<title> My list of jokes </title> |
</head> |
|
<body> |
|
<h1> My Registration Page </h1> |
|
<form name="registration" action="http://expertrating.com/registration.html"> |
|
First name: <input type=text name="realname" /> <br/> |
Last name: <input type=text name="sirname" /> <br/> |
Password: <input type=password name="pass"/> <br/> |
Re-Type Password: <input type=password name="repass"/> |
|
<h2>Additional Information </h2> |
|
SEX<br/> |
<select name="sex"> |
<option value="001"> Male </option> |
<option value="002"> Female </option> |
</select><br/> |
|
SELECTION OF JOKES<br/> |
<select name=”jokenumber”> |
<optgroup label=”Game jokes”> |
<option value=”001”> Cricket jokes </option> |
<option value=”002”> Golf jokes </option> |
</optgroup> |
|
<optgroup label=”Other jokes”> |
<option value=”111”> Classic jokes </option> |
<option value=”112”> Short jokes </option> |
</optgroup> |
</select><br/> |
|
|
<label for=”moreinfo”> Do you want more information on jokes? </label> |
<input type=checkbox name=”moreinfo” id=”moreinfo” /><br/><br/> |
|
Enter your comments: |
<textarea name=”comments” cols=40 rows=3 wrap=soft> |
</textarea><br/><br/> |
|
<button type=reset> Reset </button><br/> |
<button type=submit>Send This </button> |
</form> |
|
</body> |
</html> |
| |
| |
| |
| |
| Summary |
| |
In this chapter you have learnt:
- The form tag creates a form to be input by the user. It can contain text fields, check boxes, radio buttons and more.
- The name attribute of form tag is an optional attribute.
- The action attribute of form tag takes up a URL as its value. It sends the data to the URL defined in action when the submit button is pressed.
- The <input> tag defines the start of an input field where the user can enter his data.
- Button, checkbox, hidden, image, password, radio, reset, submit, and text are various attributes of input tag.
- The option tag is used with the <select> tag to create select lists.
- The optgroup tag defines an option group. Various choices can be grouped with the help of this tag.
|
| |
| Review Questions |
| |
Question 1
Which tag is used to create a form?
Answer
Form Tag
Question 2
Which attribute of the form tag defines a unique name for the form?
Answer
Name attribute
Question 3
Which is the most important attribute of input tag?
Answer
Type attribute
Question 4
Which tag is used with the select tag to create select lists?
Answer
Option tag
Question 5
Which tag is used to create a field where a user can enter a large amount of text?
Answer
TextArea Tag
|
| |
| |
| What's Next |
| |
The next chapter will acquaint you with the basic concepts of tables in a web page. It will also tell you how to add data and colors in the tables.
Hop over to the next chapter to get a close up on tables.
|
| |