HTML
HTML
HTML
1
Definitions
W W W – World Wide Web.
HTML – HyperText Markup Language – The
Language of Web Pages on the World Wide
Web.
HTML is a text formatting language.
URL – Uniform Resource Locator.
Browser – A software program which is used to
show web pages.
2
3
html tags are as follows:
1. <!DOCTYPE html> indicated to the browser that the document is HTML type. This
is the declaration of the HTML5 document.
2. <html> element is the parent tag of the HTML document. All the other tags are
enclosed within this tag. It is a container tag i.e. starts with <html> and ends with
</html>.
3. <head> element contains information related to the web page that is not displayed to
the user. It is a container tag i.e. it starts with <head> and ends with </head>.It includes
other tags like-
•<style> – contains the attributes related to CSS styling.
•<meta> – It contains additional information related to the document.
•<script> – contains the javascript code to provide dynamic web-pages.
•<link> – this tag links the current document with other web pages or external style
sheets.
4. <title> element resides in the <head> tag and defines the name of the web page. It
appears as the name of the tab. It is a container tag and hence starts with <title> and ends
with </title>.
5. <body> element contains the page content that will appear on the web-page. It may be
text content, images, audio, video, links, etc. 4
1. Container tags in HTML
Tags which enclose the content with start and end tags are called container tags. For
example- <p>Hello,Welcome to DataFlair</p> Here, <p>, paragraph tag, is a container
tag.
HTML Tags that do not enclose any content and do not have any end tags are
known as non-container tags. For example, <br> tag is useful for inserting line
breaks.
5
6
“Normal text” surrounded by
bracketed tags that tell browsers
how to display web pages
Pages end with “.htm” or “.html”
HTML Editor – A word processor
that has been specialized to make
the writing of HTML documents
more effortless.
7
Tags
8
HTML Page Creation & Editing
1. Choose a Text Editor.
2. Create a Basic Starting Document.
3. Understand and set Document Properties.
4. View Your Results in a Browser.
9
Creating a Basic Starting
Document
<HTML>
<HEAD>
<TITLE>Demo</TITLE>
</HEAD>
<BODY>
This is what is displayed.
</BODY>
</HTML> 10
Creating a Basic Starting
Document
The HEAD of your document point to above
window part. The TITLE of your document
appears in the very top line of the user’s
browser. If the user chooses to “Bookmark”
your page or save as a “Favorite”; it is the
TITLE that is added to the list.
The text in your TITLE should be as
descriptive as possible because this is what
many search engines, on the internet, use for
indexing your site. 11
Setting Document Properties
12
Color Codes
• Colors are set using “RGB” color codes,
which are, represented as hexadecimal
values. Each 2-digit section of the code
represents the amount, in sequence, of
red, green or blue that forms the color. For
example, a RGB value with 00 as the first
two digits has no red in the color.
13
Main Colours
14
16 Basic Colors
15
Color Codes
1. WHITE 1. #FFFFFF
2. BLACK 2. #000000
3. RED 3. #FF0000
4. GREEN 4. #00FF00
5. BLUE 5. #0000FF
6. MAGENTA 6. #FF00FF
7. CYAN 7. #00FFFF
8. YELLOW 8. #FFFF00
9. AQUAMARINE 9. #70DB93
10. BAKER’S CHOCOLATE 10. #5C3317
11. VIOLET 11. #9F5F9F
12. BRASS 12. #B5A642
13. COPPER 13. #B87333
14. PINK 14. #FF6EC7
16
15. ORANGE 15. #FF7F00
The Body Element
• The BODY element of a web page is an
important element in regards to the page’s
appearance. Here are the attributes of the
BODY tag to control all the levels:
TEXT="#RRGGBB" to change the color of all
the text on the page (full page text color.)
This element contains information about the
page’s background color, the background image,
as well as the text and link colors.
17
Background Color
It is very common to see web pages with
their background color set to white or some
other colors.
To set your document’s background color,
you need to edit the <BODY> element by
adding the BGCOLOR attribute. The
following example will display a document
with a white background color:
<BODY BGCOLOR=“#FFFFFF”></BODY>
18
TEXT Color
<BODY BACKGROUND=“[Link]”
BGCOLOR=“#FFFFFF”></BODY>
20
Previewing Your Work
Once you have created your basic starting
document and set your document properties it
is a good idea to save your file.
To save a file, in NotePad, follow these steps:
1. Locate and click on the menu called “File”.
2. Select the option under File Menu labeled
“Save As”.
3. In the “File Name” text box, type in the entire
name of your file (including the extension
name .html).
21
Edit, Save and View Cycle
To preview Your Work, open a web browser and do the
following:
1. Click on the menu labeled “File”.
2. Locate the menu option, “Open”.
22
Edit, Save and View Cycle
3. In the “Open” dialog box, click on the
“Browse” button and locate your web
document.
4. Click “OK” once you have selected your file.
23
Headings, Paragraphs, Breaks & Horizontal
Rules
24
Headings, <Hx> </Hx>
Inside the BODY element, heading elements
H1 through H6 are generally used for major
divisions of the document. Headings are
permitted to appear in any order, but you will
obtain the best results when your documents
are displayed in a browser if you follow these
guidelines:
1. H1: should be used as the highest level of heading, H2
as the next highest, and so forth.
2. You should not skip heading levels: e.g., an H3 should
not appear after an H1, unless there is an H2 between
them.
25
Headings, <Hx> </Hx>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY>
<H1> Heading 1 </H1>
Heading 1
<H2> Heading 2 </H2> Heading 2
<H3> Heading 3 </H3>
<H4> Heading 4 </H4> Heading 3
<H5> Heading 5 </H5> Heading 4
<H6> Heading 6 </H6> Heading 5
</BODY> Heading 6
</HTML>
26
Paragraphs, <P> </P>
Paragraphs allow you to add text to a
document in such a way that it will
automatically adjust the end of line to suite
the window size of the browser in which it
is being displayed. Each line of text will
stretch the entire length of the window.
27
Paragraphs, <P> </P>
<HTML><HEAD>
<TITLE> Example Page</TITLE> Heading 1
</HEAD> Paragraph 1,….
<BODY></H1> Heading 1 </H1>
<P> Paragraph 1, ….</P>
<H2> Heading 2 </H2>
Heading 2
<P> Paragraph 2, ….</P> Paragraph 2,….
<H3> Heading 3 </H3>
<P> Paragraph 3, ….</P>
Heading 3
Paragraph 3,….
<H4> Heading 4 </H4>
<P> Paragraph 4, ….</P> Heading 4
<H5> Heading 5 </H5> Paragraph 4,….
<P> Paragraph 5, ….</P>
<H6> Heading 6</H6>
Heading 5
<P> Paragraph 6, ….</P> Paragraph 5,….
</BODY></HTML> Heading 6
Paragraph 6,….
28
Break, <BR>
Line breaks allow you to decide where the text
will break on a line or continue to the end of the
window.
A <BR> is an empty Element, meaning that it
may contain attributes but it does not contain
content.
The <BR> element does not have a closing tag.
29
Break, <BR>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY> Heading 1
<H1> Heading 1 </H1> Paragraph 1,….
<P>Paragraph 1, <BR>
Line 2 <BR> Line 3 <BR>…. Line 2
</P> Line 3
</BODY> ….
</HTML>
30
Horizontal Rule, <HR>
The <HR> element causes the
browser to display a horizontal
line (rule) in your document.
<HR> does not use a closing tag,
</HR>.
31
Horizontal Rule, <HR>
Attribute Description Default Value
Height of the rule in
SIZE 2 pixels
pixels
Width of the rule in
WIDTH pixels or percentage 100%
of screen width
Draw the rule with a Not set
NOSHADE flat look instead of a
3D look (3D look)
33
Bold, Italic and other Character Formatting
Elements
<FONT SIZE=“+2”> Two sizes bigger</FONT>
The size attribute can be set as an absolute value from 1 to 7
or as a relative value using the “+” or “-” sign. Normal text size
is 3 (from -2 to +4).
<B> Bold </B>
<I> Italic </I>
<U> Underline </U>
Color = “#RRGGBB” The COLOR attribute of the FONT
element. E.g., <FONT COLOR=“#RRGGBB”>this text has
color</FONT>
<PRE> Preformatted </PRE> Text enclosed by PRE tags is
displayed in a mono-spaced font. Spaces and line breaks are
supported without additional elements or special characters. 34
Bold, Italic and other Character Formatting
Elements
35
Bold, Italic and other Character Formatting
Elements
<P> <FONT SIZE=“+1”> One One Size Larger - Normal – One
Size Larger </FONT> - Normal Size Smaller
– Bold - italics - Underlined -
<FONT SIZE=“-1”> One Size Colored
Smaller </FONT> <BR> Emphasized - Strong - Tele
<B> Bold</B> - <I> italics</I> - Type
<U> Underlined </U> -
<FONT COLOR=“#FF0000”>
Colored </FONT> <BR>
<EM> Emphasized</EM> -
<STRONG> Strong
</STRONG> - <TT> Tele Type
</TT> <BR>
36
Alignment
Some elements have attributes for
alignment (ALIGN) e.g. Headings,
Paragraphs and Horizontal Rules.
The Three alignment values are : LEFT,
RIGHT, CENTER.
<CENTER></CENTER> Will center
elements.
37
Alignment
46
List Elements
You can specify a starting number for an ordered
list.
<OL TYPE =“i”>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
<P> text ….</P>
<OL TYPE=“i” START=“3”>
<LI> List item …</LI>
</OL>
47
List Elements
i. List item …
ii. List item …
Text ….
48
List Elements
DL: Definition List. This kind of list is different from the
others. Each item in a DL consists of one or more
Definition Terms (DT elements), followed by one or
more Definition Description (DD elements).
<DL>
<DT> HTML </DT>
<DD> Hyper Text Markup Language </DD>
<DT> DOG </DT>
<DD> A human’s best friend!</DD>
</DL>
HTML
Hyper Text Markup Language
DOG
A human’s best friend!
49
Nesting Lists
You can nest lists by inserting a UL, OL, etc., inside a list
item (LI).
EXample
<UL TYPE = “square”>
<LI> List item …</LI>
<LI> List item …
<OL TYPE=“i” START=“3”>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
</LI>
<LI> List item …</LI> 50
</UL>
What will be the output?
<H1 ALIGN="CENTER">SAFETY TIPS FOR CANOEISTS</H1>
<OL TYPE=“a” START=“2”>
<LI>Be able to swim </LI>
<LI>Wear a life jacket at all times </LI>
<LI>Don't stand up or move around. If canoe tips,
<UL>
<LI>Hang on to the canoe </LI>
<LI>Use the canoe for support and </LI>
<LI>Swim to shore
</UL> </LI>
<LI>Don't overexert yourself </LI>
<LI>Use a bow light at night </LI>
</OL>
51
The output….
52
<H1 ALIGN="CENTER">SAFETY TIPS FOR
CANOEISTS</H1>
<OL TYPE="a" START="2">
<LI>Be able to swim </LI>
<LI>Wear a life jacket at all times </LI>
<LI>Don't stand up or move around. If canoe tips,
<UL>
<LI>Hang on to the canoe </LI>
<LI>Use the canoe for support What
<OL type="I" start="4">
<LI> Be careful </LI>
will
<LI> Do not look around</LI> be the
</LI> </OL> output?
<LI>Swim to shore
</UL> </LI>
<LI>Don't overexert yourself </LI>
<LI>Use a bow light at night </LI>
53
</OL>
The output….
54
Images
<IMG>This element defines a graphic image on
the page.
Image File (SRC:source): This value will be a
URL (location of the image) E.g.
[Link] or /dir/[Link].
Alternate Text (ALT): This is a text field that
describes an image or acts as a label. It is
displayed when they position the cursor over a
graphic image.
Alignment (ALIGN): This allows you to align the
image on your page.
55
Images
Width (WIDTH): is the width of the image in pixels.
Height (HEIGHT): is the height of the image in
pixels.
Border (BORDER): is for a border around the
image, specified in pixels.
HSPACE: is for Horizontal Space on both sides of
the image specified in pixels. A setting of 5 will put 5
pixels of invisible space on both sides of the image.
VSPACE: is for Vertical Space on top and bottom of
the image specified in pixels. A setting of 5 will put 5
pixels of invisible space above and bellow the
image.
56
Some Examples on images
1) <IMG SRC“=[Link]“ border=4>
2) <IMG SRC "=[Link] "width="60"
height="60">
3) <IMG SRC“=[Link] "ALT="This is a
text that goes with the image">
4) <IMG SRC "=[Link]“ Hspace"=30 "
Vspace"=10" border=20>
5) < IMG SRC =" [Link]“ align="left">
blast blast blast blast blast
57
Anchors, URLs and Image Maps
In this chapter you will learn about Uniform Resource
Locator, and how to add them as Anchor or Links
inside your web pages.
Objectives
Upon completing this section, you should be able to
1. Insert links into documents.
2. Define Link Types.
3. Define URL.
4. List some commonly used URLs.
5. Plan an Image Map.
58
HOW TO MAKE A LINK
1) The tags used to produce links are the <A>
and </A>. The <A> tells where the link should start and
the </A> indicates where the link ends. Everything between
these two will work as a link.
59
HOW TO MAKE A LINK
<html>
<body>
<h1>HTML Links</h1>
<p><a href="[Link]
[Link]!</a></p>
</body>
</html>
60
HOW TO MAKE A LINK
HTML Links - The target Attribute
By default, the linked page will be displayed in the current browser
window. To change this, you must specify another target for the link.
61
HOW TO MAKE A LINK
<html>
<body>
</body>
</html>
62
More on LINKs
<body LINK="#C0C0C0" VLINK="#808080"
ALINK="#FF0000">
• LINK - standard link - to a page the visitor hasn't
been to yet. (standard color is blue - #0000FF).
VLINK - visited link - to a page the visitor has been to
before. (standard color is purple - #800080).
ALINK - active link - the color of the link when the
mouse is on it. (standard color is red - #FF0000).
If the programmer what to change the color
• Click <a href"=http//:[Link]"><font
color="FF00CC">here</font></a> to go to yahoo.
63
Internal Links
Internal Links : Links can also be created inside large
documents to simplify navigation. Today’s world wants to be
able to get the information quickly. Internal links can help you
meet these goals.
1. Select some text at a place in the document that you would
like to create a link to, then add an anchor to link to like this:
<A NAME=“bookmark_name”></A>
The Name attribute of an anchor element specifies a location
in the document that we link to shortly. All NAME attributes in
a document must be unique.
2. Next select the text that you would like to create as a link to
the location created above.
<A HREF=“#bookmark_name”>Go To Book Mark</A>
64
Internal Links
<html>
<body>
<p><a href="#C4">Jump to Chapter 4</a></p>
<p><a href="#C6">Jump to Chapter 10</a></p>
<h2>Chapter 1</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 2</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 3</h2>
<p>This chapter explains ba bla bla</p>
<h2 id="C4">Chapter 4</h2>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 5</h2>
<p>This chapter explains ba bla bla</p>
<h2 id =“C6”>Chapter 6</h2>
<p>This chapter explains ba bla bla</p>
</body> 65
</html>
Tables
• The <TABLE></TABLE> element has four sub-
elements:
1. 1. Table Row<TR></TR>.
2. 2. Table Header <TH></TH>.
3. 3. Table Data <TD></TD>.
4. 4. Caption <CAPTION></CAPTION>.
66
Tables
<table border=“1”>
<tr>
<th> Column 1 header </th>
<th> Column 2 header </th>
</tr>
<tr>
<td> Row1, Col1 </td>
<td> Row1, Col2 </td>
</tr>
<tr>
<td> Row2, Col1 </td>
<td> Row2, Col2 </td>
</tr>
</table>
67
Tables
68
Tables Attributes
BGColor: Some browsers support background
colors in a table.
Width: you can specify the table width as an
absolute number of pixels or a percentage of the
document width. You can set the width for the
table cells as well.
Border: You can choose a numerical value for
the border width, which specifies the border in
pixels.
CellSpacing: Cell Spacing represents the space
between cells and is specified in pixels. 69
Table Attributes
CellPadding: Cell Padding is the space
between the cell border and the cell
contents and is specified in pixels.
Align: tables can have left, right, or
center alignment.
Background: Background Image, will be
titled in IE3.0 and above.
BorderColor
70
Table Caption
A table caption allows you to specify a line of
text that will appear centered above or bellow
the table.
<TABLE BORDER=1 CELLPADDING=2>
<CAPTION > Label For My Table </CAPTION>
71
Table Header
72
Table Data and Table Header
Attributes
Colspan: Specifies how many cell columns of the table
this cell should span.
Rowspan: Specifies how many cell rows of the table this
cell should span.
Align: cell data can have left, right, or center alignment.
Valign: cell data can have top, middle, or bottom
alignment.
Width: you can specify the width as an absolute number
of pixels or a percentage of the document width.
Height: You can specify the height as an absolute
number of pixels or a percentage of the document height.
73
Basic Table Code
<TABLE BORDER=1 width=50%>
<CAPTION> <h1>Spare Parts <h1> </Caption>
<TR><TH>Stock Number</TH><TH>Description</TH><TH>List
Price</TH></TR>
<TR><TD bgcolor=red>3476-AB</TD><TD>76mm
Socket</TD><TD>45.00</TD></TR>
<TR><TD >3478-AB</TD><TD><font color=blue>78mm Socket</font>
</TD><TD>47.50</TD></TR>
<TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR>
</TABLE>
74
Table Data and Table Header Attributes
75
Table Data and Table Header
Attributes
Row 1 Col 1
Row 2 Col 2
Row 2 Col 1
Row 3 Col 2
76
Special Things to Note
• TH, TD and TR should always have end tags.
Although the end tags are formally optional, many browsers will
mess up the formatting of the table if you omit the end tags. In
particular, you should always use end tags if you have a TABLE
within a TABLE -- in this situation, the table parser gets
hopelessly confused if you don't close your TH, TD and TR
elements.
• A default TABLE has no borders
By default, tables are drawn without border lines. You need the
BORDER attribute to draw the lines.
• By default, a table is flush with the left margin
TABLEs are plopped over on the left margin. If you want
centered tables, You can either: place the table inside a DIV
element with attribute ALIGN="center".
Most current browsers also supports table alignment, using the
ALIGN attribute. Allowed values are "left", "right", or "center", for
example: <TABLE ALIGN="left">. The values "left" and "right"
float the table to the left or right of the page, with text flow
allowed around the table. This is entirely equivalent to IMG
alignment 77
What will be the output?
79
Targets
When you use links for use in a frames environment you
will need to specify an additional attribute called TARGET.
The TARGET attribute uses the NAME attribute of the
FRAME element.
If we were to place a link in [Link] that linked to
[Link] and we wanted [Link] to be displayed in the
right windowpane; the HTML code would appear in
[Link] as follows:
<A HREF=“[Link]”
TARGET=“right_pane”>Link to Document 3
</A>
80
Special Targets
• There are 4 special target names that cannot be assigned by
the NAME attribute of the FRAME tag.
1. TARGET=“_top” : This loads the linked document into the full
browser window with the URL specified by the HREF attribute.
All frames disappear, leaving the new linked page to occupy
the entire window. The back is turned on.
2. TARGET=“_blank” : Opens an unnamed new browser
window and loads the document specified in the URL attribute
into the new window (and your old window stays open). The
back is turned off. Other windows remains on.
83
Forms
To insert a form we use the <FORM></FORM> tags. The rest of the
form elements must be inserted in between the form tags.
<HTML> <HEAD>
<TITLE> Sample Form</TITLE>
</HEAD>
<BODY BGCOLOR=“FFFFFF”>
<FORM ACTION = [Link]
<P> First Name: <INPUT TYPE=“TEXT” NAME=“fname”
MAXLENGTH=“50”> </P>
<P> <INPUT TYPE=“SUBMIT” NAME=“fsubmit1” VALUE=“Send Info”>
</P>
</FORM>
</BODY> </HTML>
84
<FORM> element attributes
ACTION: is the URL of the CGI (Common
Gateway Interface) program that is going to
accept the data from the form, process it, and
send a response back to the browser.
METHOD: GET (default) or POST specifies
which HTTP method will be used to send the
form’s contents to the web server. The CGI
application should be written to accept the
data from either method.
NAME: is a form name used by VBScript or
JavaScripts.
TARGET: is the target frame where the
response page will show up.
85
Form Elements
Form elements have properties: Text
boxes, Password boxes, Checkboxes,
Option(Radio) buttons, Submit, Reset,
File, Hidden and Image.
The properties are specified in the
TYPE Attribute of the HTML element
<INPUT></INPUT>.
86
Sami Ali
Al al-Bayt University
87
Form Elements
<INPUT> Element’s Properties
TYPE= Type of INPUT entry field.
NAME = Variable name passed to CGI application
VALUE= The data associated with the variable
name to be passed to the CGI application
CHECKED= Button/box checked
SIZE= Number of visible characters in text field
MAXLENGHT= Maximum number of characters
accepted.
88
Text Box
Text boxes: Used to provide input fields for text,
phone numbers, dates, etc.
<INPUT TYPE= " TEXT " >
Browser will display
Textboxes use the following attributes:
TYPE: text.
SIZE: determines the size of the textbox in
characters. Default=20 characters.
MAXLENGTH : determines the maximum number
of characters that the field will accept.
NAME: is the name of the variable to be sent to the
CGI application.
VALUE: will display its contents as the default value. 89
Example on Text Box
<TITLE>Form_Text_Type</TITLE>
</HEAD> <BODY>
<h1> <font color=blue>Please enter the following
bioData</font></h1>
<FORM name"=fome1 " Method= " get " Action= " URL " >
First Name :<INPUT TYPE"=TEXT "NAME"=FName"
SIZE"=15 "MAXLENGTH"=25"><BR>
Last Name :<INPUT TYPE"=TEXT "NAME"=LName"
SIZE"=15 "MAXLENGTH"=25"><BR>
Nationality :<INPUT TYPE"=TEXT "NAME"=Country"
SIZE"=25 "MAXLENGTH"=25"><BR>
The Phone Number :<INPUT TYPE"=TEXT "NAME"=Phone"
SIZE"=15 "MAXLENGTH"=12"><BR>
</FORM> </BODY> </HTML>
90
Output
91
Password
Password: Used to allow entry of passwords.
<INPUT TYPE= " PASSWORD " >
Browser will display
Text typed in a password box is starred out in the browser
display.
Password boxes use the following attributes:
TYPE: password.
SIZE: determines the size of the textbox in characters.
MAXLENGTH: determines the maximum size of the
password in characters.
NAME: is the name of the variable to be sent to the CGI
application.
VALUE: is usually blank. 92
Example on Password Box
<HTML><HEAD>
<TITLE>Form_Password_Type</TITLE></HEAD>
<BODY>
<h1> <font color=red>To Access, Please
enter:</font></h1>
<FORM name"=fome2 "Action"=url "method"=get">
User Name :<INPUT TYPE"=TEXT "Name"=FName"
SIZE"=15 "MAXLENGTH"=25"><BR>
Password :<INPUT TYPE"=PASSWORD "
NAME"=PWord " value ""=SIZE"=15”
MAXLENGTH"=25"><BR>
93
</FORM></BODY> </HTML>
Output
94
Check Box
Check Box: Check boxes allow the users to select
more than one option.
<INPUT TYPE=“CHECKBOX”>
Browser will display
97
Radio Button
Radio Button: Radio buttons allow the users to select
only one option.
<INPUT TYPE=“RADIO”>
Browser will display
98
<HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD>
<BODY>
<h1> <font color=green>Please check one of the
following</font></h1>
<FORM name"=fome3 "Action"=url "method"=get">
<font color=red> Select Country :</font><BR>
jordan:<INPUT TYPE" =RADIO " Name"=country "
CHECKED><BR>
Yemen<INPUT TYPE"=RADIO " Name"=country"><BR>
Qatar:<INPUT TYPE"=RADIO " Name"=country"><BR>
<BR>
<font color=blue>Select Language:</font><BR>
Arabic:<INPUT TYPE"=RADIO " Name"=language "
CHECKED><BR> English:<INPUT TYPE "=RADIO "
Name"=language"><BR>
French:<INPUT TYPE "=RADIO " Name"=language">
<BR></FORM> </BODY></HTML>
99
100
<HTML><HEAD>
<TITLE>RADIOBox</TITLE> </HEAD>
<BODY>
Form #1:
<FORM>
<INPUT TYPE="radio" NAME="choice" VALUE="one"> Yes.
<INPUT TYPE="radio" NAME="choice" VALUE="two"> No.
</FORM>
<HR color=red size="10" >
Form #2:
<FORM>
<INPUT TYPE="radio" NAME="choice" VALUE="three"
CHECKED> Yes.
<INPUT TYPE="radio" NAME="choice" VALUE="four"> No.
</FORM>
</BODY></HTML>
101
Output
102
Push Button
Push Button: This element would be used with
JavaScript to cause an action to take place.
<INPUT TYPE=“BUTTON”>
Browser will display
103
<DIV align=center><BR><BR>
<FORM>
<FONT Color=red>
<h1>Press Here to see a baby crying:<BR>
<INPUT TYPE"=button "
VALUE"=PressMe"><BR><BR>
<FONT Color=blue>
Click Here to see a baby shouting:<BR>
<INPUT TYPE"=button "VALUE"=ClickMe ">
<BR><BR>
<FONT Color=green>
Hit Here to see a baby eating:<BR>
<INPUT TYPE"=button "VALUE"=HitME "> <BR><BR>
<FONT Color=yellow>
</FORM></DIV> 104
105
Submit Button
Submit: Every set of Form tags requires a Submit
button. This is the element causes the browser to
send the names and values of the other elements to
the CGI Application specified by the ACTION attribute
of the FORM element.
<INPUT TYPE=“SUBMIT”>
106
<FORM Action"=URL "method"=get">
First Name :<INPUT TYPE"=TEXT "Size=25
name"=firstName"><BR>
Family Name :<INPUT TYPE"=TEXT "Size=25
name"=LastName"><BR>
<BR>
<FONT Color=red>
Press Here to submit the data:<BR>
<INPUT TYPE"=submit "VALUE"=SubmitData " >
</FORM>
107
108
Reset Button
• Reset: It is a good idea to include one of
these for each form where users are entering
data. It allows the surfer to clear all the input
in the form.
• <INPUT TYPE=“RESET”>
109
<FORM Action"=URL "method"=get">
First Name :<INPUT TYPE"=TEXT "Size=25
name"=firstName"> <BR>
Family Name :<INPUT TYPE"=TEXT "Size=25
name"=LastName"><BR>
<BR>
<FONT Color= red>
<STRONG><font size=5>Press Here to submit
the data:</font></STRONG><BR>
<INPUT TYPE"=submit "VALUE"=SubmitData">
<INPUT TYPE"=RESET "VALUE"=Reset">
</FORM>
110
111
Image Submit Button
Image Submit Button: Allows you to substitute
an image for the standard submit button.
112
<form>
<H1><font color=blue>
Click to go Jordan’s Map: </H1>
<INPUT TYPE"=IMAGE "SRC"=[Link]">
</form>
113
File
• File Upload: You can use a file upload to allow surfers to
upload files to your web server.
• <INPUT TYPE=“FILE”>
• Browser will display
115
Other Elements used in Forms
<TEXTAREA></TEXTAREA>: is an element
that allows for free form text entry.