CHAPTER – 6 (More Elements in HTML)
HTML FORMS: HTML forms are set of different form elements that allow interacting with the user
by your HTML web page and collecting the data and information from user. A form tag is used to
create a form in HTML. Attributes of the <form> tag are:
a. Action: This accept the file name or page should be redirected after click on
the button.
b. Method: This specifies how the data will be saved either get or post after
click. The value get means getting data and post means sending data to
server.
<form action=”message.html” method=”Get”>……..</form>
HTML Form Fields: HTML supports certain fields to collect different information from user. These
fields are as following:
1. Textbox: It is used to allow entering a single line text field in HTML forms. It is mostly used
to collect Names or any single value in forms. Attributes of the <textbox> tag are:
a. Type: It must text when you want to insert textbox.
b. Size: It specifies the width of the textbox. It must be a numeric value.
c. Maxlength: It is used to specify the maximum number of characters allowed
on a textbox.
d. Value: It is used to provide the default text inside textbox.
Syntax: Name: <input type=”text” size=40 maxlength=”10″ value=”Enter text”>
2. Radio Buttons: These fields are used to accept a single value from given multiple choices or
options. It looks like a circle with a dot when selected. Attributes of the <radio buttons>
tag are:
a. Name: When you want to allow to select a single value, you have give same
name to all radio buttons in the form.
b. Value: It saves the text written as value into the database when submit button
is clicked.
c. Checked: If you want to display the checkbox should be selected
automatically on page loads in the browser, you can use this attribute.
Syntax:
<input type=”radio” name=”gen” value=”Male” checked>Male
<input type=”radio” name=”gen” value=”Female”>Female
3. Checkbox: It is used to select multiple choices from a given set of values. It is coming in a
square box with a tick mark in front of it when selected. Attributes of the <checkbox> tag
are: Name, Value, Checked
Syntax:
<input type=”checkbox” name=”hobies” value=”Playing” checked>Playing
<input type=”checkbox” name=” hobies” value=”Reading”>Reading
4. Password: It is similar to the textbox field but the characters are displayed in a special
symbolic form when the user enters them. It is used to collect a password from the user.
Syntax: Password: <input type=”password” size=10 maxlength=”10″>
5. TextArea: It is used to collect multi-line text entries in HTML forms. This field is used to
accept the address field in a form. Attributes of the <textarea> tag are:
a. Rows: Specifies number of lines in the textarea field by default.
b. Cols: Allow number of characters allowed in a single line.
Syntax: Address: <textarea rows=7 cols=40> </textarea>
Prepared By: Manish Kumar Sharma (PGT Computer) Class 10th Notes Page|10
6. Combobox: It provides a drop-down list. It means when users click on the small arrow
coming to next to the dropdown it will expand to downwards and display the list. To
create combobox you need to combine two tags in HTML form.
a. Select: To create a list
b. Option: To create item list to fill in combobox.
Syntax: <select>
<option> January </option>
<option Selected> February </option>
<option> March </option>
</select>
7. Button: Buttons are used to submit or save the data as well as clear the entered data into
form.
Syntax: <input type=”submit” value=”Save”>
<input type=”reset” value=”reset”>
Embed audio and video in a HTML: A new feature of HTML5 allows us to insert audio and
video in the webpage.
1. Inserting Audio: <AUDIO> is a container element to insert audio on a webpage. Attributes
of the <Audio> tag are:
a. Controls: This attribute is used to establish whether user interface items for
controlling the resource should be displayed or not. This will enable the user
to play, pause or stop the audio.
b. Src: This attribute defines the source for the audio file and it is mentioned
along with the file extension of the audio being used.
Syntax: <audio controls src=”Track1.mp3”> </audio>
2. Inserting Video: <VIDEO> is a container element to insert video on a webpage. Attributes
of the <Video> tag are:
c. Controls: This attribute is used to establish whether user interface items for
controlling the resource should be displayed or not. This will enable the user
to play, pause or stop the video.
d. Src: This attribute defines the source for the video file and it is mentioned
along with the file extension of the video being used.
e. Height and Width: These attributes are used to set the size of the video being
inserted.
Syntax: <video controls src="Movi.mp4" height="380" width="380"></video>
$###############$
Prepared By: Manish Kumar Sharma (PGT Computer) Class 10th Notes Page|11