Professional Documents
Culture Documents
Course Objective
To provide knowledge on web architecture, web services, client side and server side
scripting technologies to focus on the development of web-based information systems and
web services.
To provide skills to design interactive and dynamic web sites.
Course Outcome
UNIT -1
Introduction to Internet : Definition of Internet – History of Internet – Advantages &
disadvantages of Internet – Tools of internet - How internet works. Introduction to WWW:
Definition of WWW –WWW tools - Web Terminology –web browser – web server
UNIT-2
E-Mail : Definition of e-mail – advantages & disadvantages of e-mail – how to work with e-
mail accounts – e-mail inner working : Store and forward method & Central mail spool
method– message components – message composition – features of e-mail. Protocols:
TCP/IP - HTTP
UNIT -3
Introduction to HTML: Basic HTML – HTML document structure – HTML tags – Basefont
tag – title tag – body tag – Text formatting tags – Character tags - Character entities
HTML Lists : Ordered List , Unordered List & Definition List – Using colors – Using Images
Andhra Pradesh State Council of Higher Education
B.Sc. Computer Science/Information Technology (IT) Syllabus Under CBCS
w.e.f.2017-2018
Structure of Computer Science/Information Technology (IT) Syllabus
UNIT – 4
Horizontal Rule Tag - HTML Tables – Nested Tables - Hyperlinks: Textual, Graphical Links
to sections – Multimedia Objects – Frames – Nested Frames – Forms – Form Controls :
textbox, password, checkbox, radio button, select, text area - Processing of forms
UNIT – 5
Advanced HTML : Cascading Style Sheets: Introduction – Using Styles: As an attribute, tag
& external file – Defining Your own styles – Properties and values : properties related to
Fonts , Backgrounds & colors, text , boxes & borders
Text Book
1. Inline/Online: Fundamentals of the Internet and the World Wide Web, Raymond
Greenlaw Ellen Hepp, McGraw – Hill
2. Harvey M. Deitel and Paul J. Deitel, “Internet & World Wide Web How to
Program”, 4/e, Pearson Education.
References:
Student Activities:
Two questions must be given from each unit in Section-A and Section-B
Andhra Pradesh State Council of Higher Education
F2
F1
F3
Each computer on the Internet is called a Host. To connect to the Internet, the user
must gain access thru a commercial Internet Service Provider (ISP).
Foundation:
1) In the early 1960’s American defense department developed a network to connect the
powerful computers for information exchange expecting nuclear attack.
2) In 1969, The ARPA (Advanced Research Projects Agency) of American defense
department researchers used packet switching to connect few computers. This network
is called as ARPANET (Advanced Research Projects Agency Network). This network
later called the ‘Internet’.
3) In 1972, a program developed for e-mail used to send and receive messages over the
Internet. It includes two important tools to transfer files and access remote computers.
Theyare: FTP (File Transfer Protocol) and TELNET (or) Remote Login
4) In 1979, a group of students and programmers started Usenet (Users News Network)
that provides NEWS through network.
Commercial use of Internet:
8) In 1991 the NSF implemented privatization of Internet using Network Access Points
(NAPs) each operated by a separate company that sell Internet access through Internet
Services Providers (ISP’s).
9) Within 30 years, the Internet became one of the amazing technologies. Every year
billions of dollars spent for the development of Internet. Now the Internet has become
Krishna Degree College 5
WEB PROGRAMMING BCA II Year IV Semester
the world largest network.
ADVANTAGES OF INTERNET
Eg: abcnellore@gmail.com
7. Search Engine:
The World Wide Web stores large amount of information on variety of topics in
many websites. Finding information from these sites is very difficult. Hence search
engine software is used.
A search Engine is special website used to find information stored on various websites.
Today more than 370 search engines are available on the Internet.
1) Internet Fraud: Internet fraud means that stealing personal information, conducting
fraudulent transactions over the Internet etc. The following are some common Internet
frauds.
a) Purchase Fraud: It occurs when a criminal purchases a product by using a fake
credit card. So the merchant does not receive money.
b) Online auction fraud: This fraud occurs when a fraudster starts an auction of
items on a website. He then accepts payment from auction winner. But the product
is not delivered.
c) Online retail fraud: This fraud occurs after receiving the payment either the
product is not delivered or damaged product is delivered.
d) Phishing: It is an activity that collects confidential information such as passwords,
credit card details, account numbers, etc. It is done thru messages or mails.
2) Denial of Service (DoS): It is an attempt to make a computer resource unavailable to
its users. DoS mainly attacks web servers of banks, Government organizations, credit
card payment gateways etc.
3) Spam Mail: Unauthorized users may send a large number of unwanted Email
messages toa particular mail server to full its disk space.
4) Addiction to Internet: People also get addicted to the Internet. Some people spend
most of their valuable time in browsing the internet. Internet Addiction has been
known to be amajor cause of obesity and some time leads to various diseases.
5) Malware Attacks: Malware (Malicious Software) is software designed with wrong
ideas. It is particularly designed to gain access to a computer either to disturb its
operation or to collect important data from it. It is a big threat to Internet security. It
includes virus, spyware, worm, Trojan horse.
HOW INTERNET WORKS
If we send the message from one computer (1.2.3.4) to another computer (5.6.7.8)
through Internet, it is transmitted as shown below:
TOOLS OF INTERNET
The Internet is now a globally used computer network that has millions of users to
access information available in World Wide Web. It contains extensive information about
large number of subjects, universities, organizations, companies, individuals and provides
many services over the Internet.
For example, a computer user connects to the Internet for e-mail, web searching,
file transfers etc. To use these services Internet provides many tools or services. Some of
them areas follows:
1) e-mail 5) Telnet
2) WWW (World Wide Web) 6) Gopher
3) IRC (Internet Relay Chat) 7) WAP (Wireless Application Protocol)
4) FTP (File Transfer Protocol) 8) VoIP (Voice over Internet Protocol)
WWW TOOLS
1. e-mail 5. Telnet
2. WWW (World Wide Web) 6. Gopher
3. IRC (Internet Relay Chat) 7. WAP (Wireless Application
4. FTP (File Transfer Protocol) Protocol)
8. VoIP (Voice over Internet Protocol)
2. World Wide Web: WWW is a global information service for publishing information
on the Internet. It is a software application through which Internet users can access
global data in the form of web pages (hypertext documents). These hypertext
documents can be transferred through the Hyper Text Transfer Protocol (HTTP).
3. IRC: Internet Relay Chat (IRC) protocol is used to chat on the web. A user must require
an IRC program for chatting. This program connects to an IRC server and allows the
user to visit IRC channels.
1. Examples: EFnet (Eris Free Network), NewNet etc.
4. File Transfer Protocol (FTP): The FTP is most commonly used Internet tool to
transfer files from client’s computer to web server. It provides security to the stored
files and programs. It is mainly used by web site developers.
5. Telnet: Telnet is a network protocol that allows a user on one computer to log into
another computer. It is a tool that allows user to log into a remote system just as they
are logging into a local system. Once logged into the remote system, users can use it
as their own system.
6. Gopher: It is a protocol designed for searching and retrieving documents over the
Internet. Gopher is one of the information search and retrieval tools of Internet. Gopher
provides the user with tools to locate information on specific topics around the world.
7. WAP: WAP stands for Wireless Application Protocol. WAP is a technical standard for
accessing information on wireless devices like mobile phones. A WAP browser for
mobile devices uses this protocol. It supports Internet services like e-mail, searching
etc.
8. VoIP (Voice over Internet Protocol): It is a group of technologies for the delivery of
voice communications and multimedia sessions over Internet. VoIP is also known as
IP telephony or Internet telephony.
WEB BROWSERS
A web browser, simply called browser, is a software application for retrieving,
presenting, and traversing information resources on the World Wide Web. It allows
users to
view or browse HTML documents on WWW. An information resource is identified
by a Uniform Resource Locator (URL) and may be a web page, image, video or any other
content.
Most Web browsers are also capable of downloading and transferring files,
providing access to newsgroups, displaying graphics, playing audio and video files
associated with the document.
The major web browsers are Mozilla Firefox, Google Chrome, Microsoft
Internet Explorer, Opera, and Safari.
Krishna Degree College 10
WEB PROGRAMMING BCA II Year IV Semester
WEB SERVERS
A web server is a computer that runs websites. It contains server software that
uses HTTP to serve HTML documents, any associated files and scripts when requested
by a clientor Web browser.
The primary function of a web server is to store, process and deliver web pages to
users. Pages delivered are most frequently HTML documents, which may include text,
images, stylesheets and scripts etc.
When anyone requests for a website by adding the URL or web address on a web
browser's address bar (like www.google.com), the browser sends a request to the Internet
for viewing the corresponding web page for that address. A Domain Name Server (DNS)
converts this URL to an IP Address (For example 216.58.196.195), which points to a Web
Server.
Krishna Degree College 11
WEB PROGRAMMING BCA II Year IV Semester
Apart from HTTP, a web server also supports SMTP (Simple Mail transfer
Protocol) and FTP (File Transfer Protocol) protocols for emailing and for file transfer and
storage.
A web server needs TCP/IP to work. A computer having a modem will have
TCP/IP installed, an IP address of 127.0.0.1 and a domain name of local host. If web
server software (like PWS) is installed in such computer, then HTML pages can be accessed
by those addresses. Such computer acts as both client and server.
Internet
Apache server: It is the most common web server available in the market. Apache is an o
pensource software that handles almost 70% of all websites available today. Most
of the web-based applications use Apache as their default Web Server
environment. It is mostly used in UNIX and Win32 systems.
IIS Server: Internet Information Service or Internet Information Server is also developed
by Microsoft. It is built-in software that can be available in latest versions of
Windows operating systems.
The WWW is the most widely used part of the Internet. It is based on URL and
HTTP, and allows dynamic links to a large amount of information. The following are
various terms used frequently on Internet.
ISP: An Internet service provider (ISP) is an organization that provides services for
accessing and using the Internet. Internet service providers may be commercial,
non-profit, or privately owned.
Browser: A web browser, simply called browser, is a software application for retrieving,
presenting, and traversing information resources on the World Wide Web. It
allows users to view or browse HTML documents on WWW.
The most popular browsers are Google Chrome, Mozilla Firefox, and
MicrosoftInternet Explorer.
URL: Uniform Resource Locator is the global web address of web page and other
resources on the World Wide Web. The URL is displayed in address bar of a
browser. The URLaddress contains two parts.
Eg. http://www.example.com/index.html
WWW: World Wide Web is a global information service for publishing information on
the Internet. It is a software application through which Internet users can access
global data in the form of web pages (hypertext documents). These hypertext
documents canbe transferred through the Hyper Text Transfer Protocol (HTTP).
HTTP: HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text,
graphic images, sound, video, and other multimedia files) on the World Wide
Web. It is the essential protocol used by the World Wide Web. When a user
opens their Web browser, the user is indirectly making use of HTTP.
Hypertext: Hypertext is special text which contains links to other texts. It can include
text, graphics, video and sound. The hypertext pages are interconnected by
hyperlinks, typically activated by a mouse click.
HTML: HTML stands for hypertext markup language. HTML is used to create web pages
and web applications. These web pages can be viewed using any browser software.
HTMLcontains many tags (instructions) to design web pages.
Web site: A website is a location that contains a collection of web pages. Each website
has its own unique web address (URL) which can be reached through an internet
connection.
UNIT-II
E-MAIL
E-mail is defined as transmission of messages over communication networks. E-Mail
is used in the Internet to transfer information (messages) from one author to one or more
recipients. E-Mail is one of the most popular services available through the internet.
Advantages of E-Mail:
1) Convenience 5) Reliable
2) Speed 6) Global
3) Inexpensive 7) Generality
4) Printable
1) Convenience: There is no requirement of stationary and stamps. One does not have to go
to post office. But all these things are not required for sending or receiving a mail.
2) Speed: E-Mail is fast, based on the speed of the underlying communication network.
Usually the messages can reach the destination within seconds.
3) Inexpensive: cost of sending a message is very small or less.
4) Printable: A hard copy is easy to obtain. We can keep an electronic copy of a message for
our own records.
5) Global: Using e-mail we can send messages to any part of the world where network
connections are available.
Disadvantages of E-Mail:
Apart from several benefits of E-mail, there also exists some disadvantages as discussed below:
1) Misdirection 4) Overload
2) Interception 5) Junk
3) Forgery 6) No response
1) Misdirection: Sometimes there is a chance of sending an e-mail message to an unintended
(accidentally) receiver and this cannot be identified by e-mail service.
2) Forgery: E-mail doesn’t prevent from forgery, that is, someone impersonating the sender,
since sender is usually not authenticated in any way.
3) Overload: As e-mail is too convenient, it may result in overflow of mails. Once the inbox
is full new incoming messages are rejected as a result messages can be lost.
4) Junk: sometimes we may get some unauthorized mails from unknown sender to our inbox.
These mails are called Junk mails. This process of sending junk mails is called “Spamming”
5) No response: This occurs with recipients who do not read and respond to their e-mail on
regular basis.
--------------
HOW TO WORK WITH E-MAIL
Email is a service which allows us to send the message in electronic mode over the
internet. Each user of email is assigned a unique name for his email account.
Phase 1: In this phase, the following functions will take place. They are compose, addressing,
package, stamps, and depositing a letter in a suitable place.
Phase 2: In this phase, the mail person pick up, schedule and retrieves the letter from its place
of deposit. If that letter is correctly addressed or directed with a proper postage then is routed
to its final destination mail box.
Web Technologies
Phase 3: The receiver checks for a mail, retrieves the letter from the mail box, opening the
envelope, read the mails and files it.
Mailers
Mail Servers3
Mail Boxes
Mailer:
A mailer is a software that allows the user to manage read and compose e-mail. A mailer
is also called as mail program, mail application or mail client. The mailer activity is similar to
the phase1 in the postal mail.
Mail Server:
The function of Mail Server is to receive, store and deliver a mail. Conceptually the
mail server is always “listening” for the arrival of a new e-mail. Once the e-mail has arrived
mail server checks its address and sends it to the appropriate receiver. Mail server is also called
a 24*7 machine.
Mailboxes:
Mailbox is a folder that contains emails and information about them. A mailbox is
created at the time of creating the e-mail account.
Working of E-mail:
Email working follows the client server approach. In this client is the mailer i.e. the
mail application or mail program and server is a device that manages emails.
The terms which used in E- mail working
1. Mail User Agent (MUA) : The MUA is the application the sender(who composes mail)
uses to compose and read email, such as Eudora, Outlook, Thunderbird, etc.
2. Mail Delivery Agent (MDA): A mail delivery agent or message delivery agent (MDA) is a
computer software component that is responsible for the delivery of e-mail messages to a
local recipient’s mailbox.
3. Mail Transfer Agent (MTA): A message transfer agent or mail transfer agent (MTA) or
mail relay is software that transfers electronic mail messages from one computer to another
using a client-server application architecture.
4. Domain Name System (DNS):In simpler words, a domain name system (DNS) translates
the domain name to IP addresses.
IMAP
POP
SMTP
IMAP
IMAP stands for Internet message access protocol. This protocol is also used to access e-mails but it
is far more capable than POP. One of the most prominent feature an IMAP server provides is the
Web Technologies
central access to e-mails. Unlike POP server, an IMAP server keeps the e-mails on the server itself
and so you can access e-mails from any machine or device.
This server also provides easy management of e-mails like searching, categorizing the e-mails and
placing them into various sub-folders etc. The only problem that one could imagine with IMAP
server is that you always need an Internet connection so that the e-mail client is able to fetch e-mails
from the IMAP server. But today, almost all of the e-mail clients have the capability to cache the e-
mails so that you can even view them when you are offline.
POP:
POP stands for Post Office Protocol. A POP (or POP3) server in it’s simplest form stores the
messages for a particular user in a text file. The file for a particular user is appended with
information each time an e-mail is received by a POP server. If your e-mail client is configured to
use a POP3 protocol then whenever you try to fetch e-mails through your e-mail client then a request
is sent to your POP server for the same.
A POP server requires the log-in credentials of a user that are sent through e-mail client. Once a user
is authenticated, the POP server provides access to user’s e-mails. As with any client server
architecture, the e-mail client interacts with the POP server through a predefined set of commands.
SMTP :The Simple Mail Transfer Protocol (SMTP) is an internet standard communication
protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to
send and receive mail messages. User-level email clients typically use SMTP only for sending messages
to a mail server for relaying, and typically submit outgoing email to the mail server on port 587 or 465
per RFC 8314. For retrieving messages, IMAP and POP3.
5. MTA performs a DNS lookup to figure out the recipient’s address. If recipient
address is resolved, MTA packs email in envelop and forwards it to the MTA which is
authorized to receive recipient’s mail.
Web Technologies
From: sachintendulkar<sachin@yahoo.com>
Date: Fri 24 Feb 2017 11:00:46 AM
Header Part to: dravid@gmail.com
Subject: cricket
Cc: ganguly@reddiffmail.com
Greetings Hi guys,
Text Part I want to play cricket, but I am so frustrated by my back pain that I am
not able to play. I hope we can have a match this Sunday. So practice well.
Bye……….
1. Header part
2. Greeting part
3. Text part Body part
4. Signature part
I) Header Part: The header part is the first part of the message, which contains the following
fields:
A. FROM: The From field indicates the sender’s address i.e. who sent the e-mail.
B. DATE: The Date field indicates the date when the e-mail was sent.
Web Technologies
C. TO: The To field indicates the recipient’s address i.e. to whom the e-mail is
sent.
D. SUBJECT: The Subject field indicates the purpose of e-mail. It should be
precise and to the point.
E. CC: CC stands for Carbon copy. It includes those recipient addresses whom we
want to keep informed but not exactly the intended recipient.
F. BCC: BCC stands for Black Carbon Copy. It is used when we do not want one
or more of the recipients to know that someone else was copied on the message.
II) Greeting Part: The greeting part is used to specify some greetings to the receiver. For
example, we can use greetings like hi, dear friend, respected sir etc.
III) Text Part: The main content of the e-mail message is called the text of the message or
text part. Here we can use any number of paragraphs to present our message.
IV) Signature Part: The final part of the message is known as signature. The signature part
contains sender’s complete address like name, area, phone number, e-mail ID etc.
-------------
MESSAGE COMPOSITION
Before sending an email, we need to compose a message. When we are composing an
email message. The manner in which a user can compose an e-mail message may vary from
one mail program to another, but the basic elements remain the same.
a) Structure: When the user is composing an e-mail message by using the mailer, it
will prompt the user with certain information i.e. when the user clicks the compose
button. The following information will be presented.
To:
Subject:
CC:
BCC:
Attach files
Attachments:
Formatting Toolbar
CANCEL
TO:The To field indicates the recipient’s address i.e. to whom the e-mail is
sent.
SUBJECT: The Subject field indicates the purpose of e-mail. It should be
precise and to the point.
Web Technologies
CC: CC stands for Carbon copy. It includes those recipient addresses whom
we want to keep informed but not exactly the intended recipient.
BCC: BCC stands for Blind Carbon Copy. It is used when we do not want
one or more of the recipients to know that someone else was copied on the
message.
ATTACHMENTS: The “attach files” button is used for attaching some
additional files to the original message.
b) Composition: For sending an e-mail to the close friends, we can simply type the
message and send it. When applying for jobs or communicating with the people for the
first time, then proof reading and spell checking of the message is required.
c) Netiquette (Guidelines for Message Composition):
To compose a message, the user must follow some guidelines. These guidelines
are called netiquette or Network etiquette. The common guidelines for message
composition are as follows:
1) It is always preferable to type the message in lowercase.
2) We can use some special symbols called emotion icons to represent our emotion in
the message.
3) Before sending the message, we must check the spelling mistakes in the message
by using spell checkers, which are available in the mailer.
4) Before sending the message, the user must verify the “to” address (receivers
address).
5) It is preferable to see that the message should be limited to a single page.
6) It is recommended to verify whether the senders signature was placed or not in the
message.
7) Keep size of attachment as small as possible.
E-MAIL FEATURES
Now a day the mail client comes with enhanced features. The following are some e-
mail features that most e-mail programs offer.
Offline and Online text drafting:
Messages can be composed by being online as well as offline. Online messages can be
composed by clicking either New or Compose options. To compose Off-line messages, we can
use some message composing tools like MS outlook Express etc.
Spell Check:
It is always preferable to check the composed message for spelling mistakes before
sending. Most mailers (e-mail programs) provide built in spellcheckers.
Attachments with e-mail message:
This feature allows the sender to compose a message with images, audio, video,
documents etc. along with the text.
The e-mail alerts:
If we are offline and just logged-in, e-mail program provides a message that, you have
got new messages in your inbox. If we are online, message arrival will be notified by a beep
sound.
WEB PROGRAMMING BSC III Year VI Semester
Mailbox managing:
This feature helps in creating number of file folders. Using these folders we can
manage messages date-wise, sender identity-wise and subject-wise.
Deleting a Mail:
A Received message can be deleted by selecting it and clicking delete option.
Suchdiscarded messages will be remained in Trash folder until it is deleted from it.
Removing Expired messages:
This feature helps us to automatically delete a message in case it has been read
and isolder than a certain number of days, say 30,60 or 90 days.
PROTOCOL
A protocol is a set of rules that direct how computers can communicate. The protocol defines
The way addresses are assigned to machines
The formats in which they will pass data
The amount of data which can be sent at a time
The whole of INTERNET is underpinned by two protocols, TCP (Transmission
ControlProtocol) and IP (Internet Protocol)
Transmission Control Protocol/Internet Protocol (TCP/IP):
It is the combination of two protocols TCP and IP. These protocols provide all the
requirements to transmit and receive data across complex networks. Networks are made of
layers with each layer providing certain functionality. The following figure shows how the
most important layers fit together.
1. Application layer
This is the top layer of TCP/IP protocol suite. This layer includes applications or processes that use
transport layer protocols to deliver the data to destination computers.
At each layer there are certain protocol options to carry out the task designated to that particular
layer. So, application layer also has various protocols that applications use to communicate with the
second layer, the transport layer. Some of the popular application layer protocols are :
TCP is used where a reliable connection is required while UDP is used in case of unreliable
connections.
3. Network Layer
This layer is also known as Internet layer. The main purpose of this layer is to organize or handle
the movement of data on network. By movement of data, we generally mean routing of data over
the network. The main protocol used at this layer is IP. While ICMP(used by popular ‘ping’
command) and IGMP are also used at this layer.
Internet Protocol
Once the packets are made ready to transfer by TCP these packets will be assigned
with IP header that consists of all the information that is needed to transfer a packet from
source to destination. IP packets will contain 20 to 60 bytes of header information and up
to 65,515 of message data.
Internet Addresses:
In any network each system should have identification, then only data can be sent
and received appropriately. This identification of a system in a network is called IP
address. Every system that is connected to the internet will have a unique IP address.
These IP addresses are of two types. They are:
1) Static IP Addresses which are fixed addresses
2) Addresses which are dynamically addressed each time when a system connects to
internet
Eg: 192.168.100.15
in which first two bytes represent network component and the other two bytes represent
</body>
</html>
Text (Text Formatting Commands):
The text in an HTML page can be altered in a number of ways such as the font, the look and style of
the text can be changed. The following tags can be used to alter the text:
BASEFONT Tag: The <basefont> tag is a singular tag. It is used to define the font to be used in the
web page. The default font size is “3”. Usually many browsers support the font size from 1 to 7 points.
This tag has an attribute “size” which can be used to define the font size. The syntax of the base font
tag is as follows:
<basefont size=”value”>
E.g. <basefont size=”5”>
This example sets the font size of the web page to 5 points. We can also specify the size in the
following format:
<basefont size=”+2”>
The above example sets the font size of the web page to 2points larger than the default font size.
Font Tag: The font tag is used to change the appearance of the text in a web page. It is a paired tag
and has many attributes. Some of them are:
a) FACE
b) SIZE
c) COLOR
FACE: This attribute is used to specify the type of font.
SIZE: This attribute is used to specify the font size of a particular section of a web page.
COLOR: This attribute is used to specify the text color for a particular section of a web page.
The general format of the font is as follows:
<font face=”text style” size=”value” color=”colorname/colorcode”>
text to be formatted
</font>
e.g. <body>
<font face=”verdana” size=”10” color=”red”>
Microsoft Corporation
</font>
</body>
Bold Tag: The bold tag <b> is used to make the text in bold face. It adds emphasis to the text. Most
browsers darken the text and widen the letters.
E.g. <b> India is Great </b>
Italic Tag: The italic tag <i> is used to make the text into italics.
E.g. <i> India is Great </i>
Strong Tag: The strong tag <strong> is used to indicate an even higher level of emphasis.
E.g. This is very <strong> important </strong> day for me.
Monospaced Typewriter Text Tag: This tag <tt> is used to display text as typewriter output. It is
useful for displaying program code in a web page.
E.g. <tt> India is a beautiful nation </tt>
Subscript Tag: The subscript tag <sub> is used to generate a subscript.
E.g. Formula for water is H<sub>2</sub>O.
Superscript Tag: The superscript tag <sup> is used to produce superscripts.
E.g. Ten square is written as 10<sup>2</sup>
BR Tag (Blank Return Tag or Line Break Tag):
The <br> tag is used to insert a line break i.e. a new line. This is a singular tag and has no attributes, hence
in XHTML it can also be used as <br />. It can be used in the following form:
e.g. <body>
courses in sv university <br>
1. mscs <br />
2. mpcs <br />
3. mecs
</body>
PRE Tag (PRE-Formatted):
When it is necessary to include ready-formatted text on a web page like program code, poetry etc. we
can use PRE tag <pre>. In this tag the text is only wrapped when there is a line break and tabs. The
multiple white spaces are not converted to a single space.
e.g. <pre>
main()
{
int a=10, b=20;
cout<<”Sum”<<a+b;
}
</pre>
HTML Character Entities (or Character Escape Sequences):
Sometimes the user may need to include special characters in a web page that are not available
on the keyboard and the characters, which HTML uses as control sequences. Such characters can be
displayed using Character Escape Sequences.
Character Escape Sequences are special characters composed of character strings. Each
character string is preceded by an ampersand (&). All Character Escape Sequences can be directly
included in a web page. The following are some Character Escape Sequences:
Character
Character Description
Code
“ Double Quotes "
& Ampersand Symbol &
> Greater than Symbol >
< Less than Symbol <
[Blank Space] Non-Breaking Space
© Copyright Symbol ©
® Registered Trade Mark ®
Symbol
Sample Program:
<! This program demonstrates the text formatting commands >
<html>
<head>
<title>Welcome to Text Formatting Tags</title> <! Title of the web page>
</head>
<body>
<basefont size=”5”>
<h1 align=”center”>Text Formatting Tags</h1>
<font color=”blue” size=”7” style=”verdana”>HTML</font>
stands for <b>hypertext markup language</b>. Basically <b>HTML</b> is a <i>document-
layout language</i> (i.e. document designing language) but not a programming language. It is
used to create HTML documents also called as <strong>“web pages”</strong>.
These web pages can be viewed using any browser software such as <tt>(Microsoft
Internet Explorer (or) Netscape Navigator)</tt>.
HTML provides tags from subscript and superscript. For example, we can specify square value
of “a” as:<br>
a<sup>2</sup> <br>
Similarly, the formula of water is: <br>
h<sub>2</sub>
<br> HTML provides various codes such as: <br>
© --- Copyright Symbol <br>
®--- Registered Trade Mark Symbol <br>
<--- Less Than Symbol <br>
> --- Greater Than Symbol <br>
PRE is useful for formatting computer code or poetry where whitespace is important, it is used
in the following form: <br>
<pre>
main()
{
int a=10, b=20;
cout<<”Sum”<<a+b;
}
</pre>
</body>
</html>
HTML LISTS:
A list is a collection of elements that belong to a particular category in html. There are three types of lists:
1) A numbered list (Ordered list)
2) The basic bulleted list (Unordered list)
3) Definition list
1) A numbered list (Ordered list): A numbered list is the list of elements, which is having a particular order
or sequence. In a numbered list, every element contains a particular order. In html, we can create the
numbered list by using the ordered list tag <ol>.
The general format of the ordered list is as follows:
Syntax: <ol type=”1/a/A/i/I” start=”value” compact>
<li>………….</li>
<li>………….</li>
………………
………………
</ol>
In the above syntax, the “type” attribute is used to specify a particular sequence type. In HTML we can
specify the following sequence types:
i. Arabic numbers ordering (natural numbers)
ii. Alphabetic ordering (upper case and lower case)
iii. Roman number ordering (upper case and lower case)
The “start” attribute is used for specifying the starting position for the sequence.
The “compact” attribute is used to reduce the amount of space that a list uses.
The list item tag <li> is used for specifying a particular list item. The closing tag for a list item is
required under the rules of XHTML.
Note: By default, the sequence of numbered list is numerical ordering.
E.g.-1: <ol> Output:
<li>Mangoes 1. Mangoes
2. Grapes
<li>Grapes 3. Apples
<li>Apples
</ol>
E.g.-2: <ol type=”I” start=”3”> Output:
III. Mangoes
<li>Mangoes
IV. Grapes
<li>Grapes V. Apples
<li>Apples
</ol>
E.g.-3: <ol type=”a” start=”4”>
<li>Mangoes Output:
d. Mangoes
<li>Grapes e. Grapes
<li>Apples f. Apples
</ol>
Un-ordered list:
An un-ordered list is a list of elements without any sequence. In unordered list each element starts with
a bullet point such as “filled circle”, “empty circle” (or) “filled square”.
Syntax:
<ul type=”disc/circle/square” compact>
<li>
<li>
<li>
</ul>
E.g.-1: <ul>
Output:
<li>Mangoes Mangoes
<li>Grapes Grapes
Apples
<li>Apples
</ul>
E.g.-2: <ul type=”circle”>
Output:
<li>Mangoes o Mangoes
o Grapes
<li>Grapes o Apples
<li>Apples
</ul>
Definition list:
A definition list is a list of elements in which every element is divided into two parts i.e. list item being
defined (definition term) and its definition (data definition). The data definition contains some description
about the definition term.
The general format of the definition list is as follows:
Syntax: <dl compact>
<dt>Definition term 1
<dd> Data definition
<dt> Data definition 2
<dd> Data definition
< /dl>
In the above syntax the <dl> tag is used for creating definition list. The definition term tag <dt> is
used for specifying the list item being defined. Similarly, data definition tag <dd> is used to define the
description about list item (definition term).
E.g.: <dl>
<dt>MSCS
<dd>Math’s Statistics Computer Science
----------------------
----------------------
</dl>
Note: In non-standard html versions, the closing tags of list item </li>, definition term </dt> and data
definition </dd> are optional. But in XHTML these tags are compulsory.
Sample Program:
<! This program demonstrates the HTML LISTS >
<html>
<head>
<title>Welcome to HTML Lists</title> <! Title of the web page>
</head>
<body>
<h1 align=”center”>HTML Lists</h1>
<ol type=”a”>
<li>Andhra Pradesh</li>
<li>Tamilnadu</li>
<li>Madhya Pradesh</li>
<li>Jammu & Kashmir</li>
<li>Goa</li>
</ol>
The image tag <img>, is used for placing an image on the web page as a foreground object. Such images
are called in-line images. The image tag has several attributes such as “SRC”, “HEIGHT”, “WIDTH”,
“ALT”, “ALIGN”, and “USEMAP”. The general format of image tag is as follows:
The “ALIGN” attribute with value “top/bottom/center/left/right” is used to align the image relative to
the text surrounding it on the web page.
e.g. : <body>
This is a
<img src=”d:\images\house.jpg” height=”150” width=”30%” alt=”sample image”
align=”left”>
Sample program
</body>
Image Hyperlink (Graphical Hyperlink):
The image hyperlink is a hyperlink that creates a clickable image. When we click on the image, it will
open the web page that is associated with the image hyperlink. The general format of image hyperlink is as
follows:
Syntax: <a href=”path of the web page”>
<img src=”path of the image file” height=”value” width=”value”>
</a>
E.g. <body>
<a href=”d:\kcdc\college.html”>
<img src=”d:\kcdc\college.jpg” height=”200” width=”300”>
</a>
</body>
In the above example, college.jpg image is displayed on the web page as a clickable image.
When we click on the image, the web page “college.html” is opened.
Image Maps:
Image map is a large picture which has areas that the user can click. Each clickable area provides a
link to other web page. Image maps are very popular as a navigational tool. For example, an actual
geographical map is an excellent tool for image maps. The process of creating the image maps is divided into
the following steps:
Image Tag with usemap Attribute:
Place an image on the web page that is going to be linked with the mapping code by using the
following format:
<img src=”path of image file”>
This image can be linked with mapping code by using usemap attribute in the <img> tag. The value to
the usemap attribute is mapping code name, proceeding with “#”.
For eg: - <img src=”d:\states\ap.jpg” usemap=”#mapping code name”>
Map Tag and Area Tags:
The mapping code can be developed by using area tags within <map> tag. The <area> tags are used to
draw areas on the image and these areas are bounded with (given) a name by using name attribute in the map
tag.
<map name=”mapping code name”>
-----------------
List of area tags
-----------------
</map>
By using area tag we can draw a circle, rectangle, polygon and a default shape. The syntax of area
tag is as follows:
<area shape=”shape name”
coords=”co-ordinate values”
href=”url”
alt=”Alternative text”>
In the above syntax, the SHAPE attribute defines the shape that is to be drawn on the image. The value
to this attribute should be rect, circle, poly and default.
The COORDS attribute is used to define the coordinate values of the corresponding shape. While
using default shape no need of specifying coordinate values.
Coordinates (Coords)
Shape
Circle (x, y, r) where x, y denotes as midpoint and r is
radius of circle in terms of pixels.
Rectangle (Rect) (x1,y1,x2,y2) where x1, y1 are Coordinates of
the top left corner and x2, y2 are bottom right
corner.
Polygon (Poly) (x1,y1,x2,y2,.,.,.,.xi,yi,.,.,.,.,.,xn,yn)where xi ,
yi are Coordinates of ith vertex.
Default No coordinates
The HREF attribute refers to the webpage (location) that is to be displayed, when the user clicks on a
particular area.
The ALT attribute acts as a hint to the user by displaying alternative text while clicking an area.
Sample Program:
<! This program demonstrates the Image Tag and Image Mapping>
<html>
<head> <title>Image Maps</title></head>
<body bgcolor=”Orange” text=”Black” link=”#00ff00” vlink=”#0000ff” alink=”ff0000”>
<img src=”d:\states\ap.jpg” width=”400” height=”400” usemap=”#shapes”>
<map name=”shapes”>
<area shape=”circle” coords=”50,50,30” href=”nlr.html” alt=”About Nellore”>
<area shape=”rect” coords=”200,20,350,100” href=”tirupathi.html” alt=”About
Tirupathi”>
<area shape=”poly” coords=”250,200,210,300,350,275,350,300,350,200”
href=”hyd.html” alt=”About Hyderabad”>
</map>
</body>
</html>
UNIT-4
HR TAG: The HTML <hr> tag is used for creating a horizontal line. This is also called
Horizontal Rule in HTML.
Example
<! DOCTYPE html>
<html>
<head>
<title>HTML hr Tag</title>
</head>
<Body>
<p>This text will be followed by a horizontal line <hr/></p>
</body>
</html>
Output:
Attributes: The HTML <hr> tag also supports following additional attributes:
Align: The “align” attribute is used for specifying the alignment of the table.
Noshade: Removes the usual shading effect that most browsers display.
size: Specifies the height of the horizontal rule in pixels or %.
Width: Specifies the width of the horizontal rule in pixels or %.
-----------------
HTML Tables
In html, a table is a collection of rows and columns. We can use the tables to represent
the data in row wise and column wise format. Usually the tables are used to provide information
in an organized way so that information can be easily readable and understandable.
HTML Table Tags: The following five tags are used to create a table in web pages.
1) Table Tag <TABLE>
2) Table Row Tag <TR>
3) Table Division Tag OR Table Data Tag <TD>
4) Table Header Tag <TH>
5) Caption Tag <CAPTION>
1) Table Tag: The table tag is used for creating a table environment on the web page. The
general format of the table tag is as follows:
Syntax :< TABLE BORDER=”value”
BORDERCOLOR=” color name/color code”
BGCOLOR=” color name/color code”
ALIGN=” left/center/right”
CELLSPACING=”value”
CELLPADDING=”value”
WIDTH=”value”
HEIGHT=”value”>
</TABLE>
Attributes:
Border: this attribute is used for specifying size for the table border. The default border size is
one pixel.
BorderColor: The “bordercolor” attribute is used for specifying a particular color to the table
border. BgColor: The “bgcolor” attribute is used for specifying a particular color for the table
as background. Background: The “background” attribute is used for specifying an image as
background to the table. Align: The “align” attribute is used for specifying the alignment of
the table.
Width: By using “width” attribute we can specify desired width for the table. The value to this
attribute can be either in pixels or in percentage.
Height: By using “height” attribute we can specify desired height for the table. The value to
this attribute can be either in pixels or in percentage.
Cellspacing: The “cellspacing” attribute is used for specifying particular space between the
cells in the table.
Cellpadding: The “cellpadding” attribute is used for specifying the space between the text and
the inner edges of a particular cell in the table.
E.g.: <TABLE BORDER=”2” BORDERCOLOR=” red” BGCOLOR=”
blue” WIDTH=”70%” ALIGN=” center” CELLSPACING=”10”
CELLPADDING=”10”>
---------------------------
---------------------------
</TABLE>
2) Table Row Tag: The table row tag <TR>, is used for creating a particular row in a table.
The ending tag of the table row is optional i.e. </TR>. This tag must be used with in the table
tag. The syntax of the table row tag is as follows:
Syntax: <TR BGCOLOR=” colorname/colorcode”
ALIGN=” left/center/right”
VALIGN=” top/center/right”>
</TR>
In the above syntax, the “bgcolor” attribute specify the background color of a particular row.
Align: the align attribute is used for specifying the horizontal alignment of data in a row.
Valign: The valign attribute is used for specifying the vertical alignment of data in a row.
3) Table Data Tag and Table Header Tag: The table data tag <td> and table header tag <th>
are used to create data cells and heading cells in a table row. The data in heading cells will be
displayed in bold face and aligned to center. These tags use common attributes like bgcolor,
rowspan, colspan, align, valign and nowrap. The syntax of the table header tag is as follows:
Syntax: <TH BGCOLOR=” colorname/colorcode”
ROWSPAN=”value”
COLSPAN=”value”
ALIGN=” left/center/right”
VALIGN=” top/middle/bottom”
NOWRAP>
</TH>
The table data tag <td> also follows the same syntax of <th>. In the above syntax, the
“bgcolor” attribute specifies the background color of a particular cell. The “align” attribute is
used for specifying the alignment of data in a particular cell. The “rowspan” attribute is used
for specifying the span(extent) of a particular cell towards rows (row wise). The “colspan”
attribute is used for specifying the span (extent) of a particular cell towards columns (column
wise). The valign attribute is used for specifying the vertical alignment of data in a cell. The
“nowrap” is used to remove word wrap option in a cell.
-----------------
NESTED TABLES
we can use one table inside another table. Not only tables we can use almost all the tags
inside table data tag <td>.Nested Table always need to be placed between < td > ... < /td > tags
of the outer container Table. we can format nested tables as we would format any other HTML
Table.The following HTML code create a Table with one row and two columns and inside the
second column again create another table (nested table) with two rows.
<html>
<body >
<table border=5 bordercolor=red>
<tr><td>First Column of Outer Table </td>
<td>
<table border=5 bordercolor=green>
<tr><td> First row of Inner Table </td></tr>
<tr><td> Second row of Inner Table </td></tr>
</td>
</tr>
</table>
</body>
</html>
--------------------
Hyperlink (Anchor tag or Link Tag)
Representing huge information in a single lengthy web page is not an efficient way.
Because lengthy web pages will take longer time to get downloaded, which makes the user to
wait long time. If this happens user may switch to other website to gather information.
To reduce the downloading time of the web page, huge information should be
distributed among multiple web pages rather than in a single web page. These multiple web
pages should be linked to each other so that the user can navigate among web pages to gather
information quickly. These links among web pages are called hyperlinks.
In HTML, hyperlinks can be created by using link tag (anchor tag), which uses the
following format:
<a href=” address”>text/Image</a>
In the above syntax, the link tag has three sections:
1) Opening tag with address of the referenced file (local, remote, section)
2) Content to be displayed as link
3) Closing tag
Vehicles
Vehicles.html
Bajaj Honda
B1.html H1.html
B2.htmlPR H2.html
EVIEW H3.htmlSE
ND
If we want to access c1.html in cars folder from t1.html in tractors folder, the relative path
would be:
Ex: ../cars/c1.html
Similarly, if we want to access t2.html in tractors folder from b1.html in Bajaj folder, the
relative path would be:
Ex: ../../tractors/t2.html
URL (Uniform Resource Locator): The string of characters that specify an address of a web
page is known as “uniform Resource Locator (URL)”.
The general format of the URL is:
type://host.domain/folder path/file
how where what
E.g. http://www.simhapuriuniv.ac.in/index.html
type: It defines the protocol that the browser should use to access a web page (how) from the
server. The protocol can be either: http, ftp, etc.
host.domain/folder path: It defines the domain name of the computer where the web page is
available. The name “simhapuriuniv.ac.in” in the above example, tells the browser on
which computer (where) it has to find the requested web page.
file: It is a uniquely identifiable local file name (what) that has to be loaded when the browser
requests the web server. If any page name is not specified, then the web server supplies a
default web page.
2) Content to be displayed as link:
The content that is to be enclosed between the anchor tags should be either text or image,
which acts as clickable content.
E.g. <body>
<a href=” d:\college\college.html”>
<imgsrc=” d:\college\college.jpg” height=”200”
width=”300”>
</a>
</body>
In the above example, college.jpgimage is displayed on the web page as a
clickable image. When we click on the image, the web page “college.html” is opened.
Sample Program:
<! This program demonstrates the Hyperlink Tags >
<html>
<head>
<title>Welcome to HTML Hyperlinks</title><! Title of the web page>
</head>
<body>
<h2 align=” center”>This is a text hyperlink</h2>
------------------
FRAMES
HTML frames are used to divide your browser window into multiple sections where
each section can load a separate HTML document. A collection of frames in the browser
window is known as a frameset. The window is divided into frames in a similar way the tables
are organized: into rows and columns.To display multiple web pages in a single browser
window, we use the following tags:
Frames Not Supported in HTML5.
The <frame> tag was used in HTML 4 to define one particular window (frame) within
a <frameset>.
• Frameset Tag
• Frame Tag
Frameset Tag:
The frameset tag defines how the browser window will be divided into frames.
Theses frames can be either horizontal or vertical frames. The general format of the
frame set tag is as follows:
Syntax:<frameset cols=” number of frames with size in
percentages”
rows=” number of frames with size in percentages”
border=”value”
bordercolor=” color name / color code”>
---------------------------------
---------------------------------
</frameset>
In the above syntax, the “cols” attribute is used for specifying number of
vertical frames. The “rows” attribute is used to specify the number of horizontal frames.
We can specify the size of the frames in percentage values.
The “border” attribute is used for specifying the size of the frame border.
The “bordercolor” attribute is used for specifying a particular color for the
frame border.
E.g.-1:<frameset cols=”20%, *, 20%”
border=”4”
bordercolor=” #co9ffu”>
<frame>
<frame>
<frame>
</frameset>
In the above example, the frameset tag creates three vertical frames of sizes
20%, 60% and 20%. Here the “*” symbol represents the remaining space of the web
browser i.e., 60%.
E.g.-2:<FRAMESET ROWS=”20%, *, 20%”
BORDER=”4”
BORDERCOLOR=” #CO9FFU”>
<FRAME>
<FRAME>
<FRAME>
</FRAMESET>
In the above example, the frameset tag creates three horizontal frames of sizes 20%,
60% and 20%. Here the “*” symbol represents the remaining space of the web browser
i.e., 60%
Note: While using frameset tag, the body tag must not be used in a web page.
Frame Tag:
The Frame tag is used for specifying the content of a particular frame. A frame
is an independent scrollable area of browser window. The general format of frame tag
is as follows:
Syntax:<frame src=” path of the web page”
name=” frame name”
marginwidth=”value”
marginheight=”value”
scrolling=” yes/no”
noresize>
In the above syntax,
the name attribute is used for specifying a particular name for the frame.
The src attribute is used for specifying the path of the web page that is to be displayed
in the frame.
The scrolling attribute is used for adding or removing the scrollbars in a frame. This
attribute contains values “yes” or “no”.
The “marginwidth” and “marginheight” attributes are used for specifying the left and
right margins or top and bottom margins of the frame.
By default, frames can be resized, to remove this effect we use “noresize”.
E.g. <frame src=” d:\college\a.html”
name=”one”
scrolling=” yes”
marginwidth=”5”
marginheight=”10”
noresize>
The following example creates three frames and puts three webpages: index.html,
courses.html and marks.html in those frames.
E.g.<frameset cols=” *, *, *”
border=”4”
bordercolor=” #co9ffu”>
<frame name=”one” src=” d:\college\index.html”>
<frame name=” two” src=” d:\college\courses.html”>
<frame name=” three” src=” d:\college\marks.html”>
</frameset>
Targeted Hyperlink:
Generally, when we can click a hyperlink, the web page that is linked by that
hyperlink will be opened in a separate window or same window. To display the linked
web page in a particular frame, we can use targeted hyperlinks.
A targeted hyperlink is a hyperlink, which contains a particular frame as a target
i.e. when we click the targeted hyperlink, the web page that is linked by the targeted
hyperlink will be opened in the specified target frame. In HTML, we can create targeted
hyperlinks by using the anchor tag with “target” attribute. The syntax of the targeted
hyperlink is as follows:
<a href=” path of the webpage” target=” frame name”>
----------------------------------
----------------------------------
</a>
In the above syntax, the “href” attribute is used to specify the address of the
webpage. The target attribute is used to specify the frame name as a target for the
hyperlink.
E.g. <a href=” d:\college\hello.html” target=”one”>
targeted hyperlink
</a>
Nesting of Frame: A frame in turn can be divided into frames i.e. we can create frames
inside another frame. This is called nesting of frames. We can create nested frame by
using frameset tag inside another frameset tag.
E.g. <frameset rows=”50%, *”>
<frame>
<frameset cols=”50%, *”>
<frame>
<frame>
</frameset>
</frameset>
---------------------
HTML Forms:
Html form is a collection of several fields such as text boxes, radio buttons, check
boxes, passwords, action buttons etc. Html form is a mechanism used to create interactive
(Dynamic) Webpages. Forms are generally used for collecting data.
In each web page, we can create single or multiple forms by using form tag. The
following are various tags, which are used to design a form:
1) Form Tag
2) Input Tag
3) Select Tag
4) Textarea Tag
1) Form Tag: The form tag is used to create a form. The syntax of the form tag is as follows:
<form name=” form name” action=”URL” method=” post/get”>
Form Elements
</form>
In the above syntax, the NAME attribute is used to assign a name to the form. The
ACTION attribute specifies the name and location of a CGI script that is used to process
the form data. The METHOD attribute is used for specifying how the form data should be
transferred from the browser to the web server.
Data can be sent in one of two ways: post and get. When get is used, all input
values are included as part of the URL and sent to the web server. The get method is a
default method for transferring a form.
When thepost is used, the data is encoded within the body of the message and send to the
web server after communication has been established. Post can be used to send large
amounts of data and is more secure than get.
2) Input Tag: The input tag is used for designing the html form elements. By using the input
tag, we can create the following types of form elements:
a) Text box
b) Radio buttons
c) Check box
d) Button
e) Action Buttons: Submit/Reset
f) Password field
g) Image
The general syntax of input tag:
<input
type=”text/password/checkbox/radio/submit/reset/button/image
”
name=” string”
value=” string”
size=”value”
maxlength=”value”
src=”url”
align=” left/right/top/bottom/middle”
checked>
• <input type="button">
• <input type="checkbox">
• <input type="color">
• <input type="date">
• <input type="datetime-local">
• <input type="email">
• <input type="file">
• <input type="hidden">
• <input type="image">
• <input type="month">
• <input type="number">
• <input type="password">
• <input type="radio">
• <input type="range">
• <input type="reset">
• <input type="search">
• <input type="submit">
• <input type="tel">
• <input type="text">
• <input type="time">
• <input type="url">
• <input type="week">
Example
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
First name:
Last name:
Example
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br>
<label for="pwd">Password:</label><br>
<input type="password" id="pwd" name="pwd">
</form>
Password:
The form-handler is typically a server page with a script for processing input data.
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
First name:
John
Last name:
Doe
Submit
If you omit the submit button's value attribute, the button will get a default text:
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit">
</form>
<input type="reset"> defines a reset button that will reset all form values to their
default values:
Example
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
<input type="reset">
</form>
First name:
John
Last name:
Doe
Submit Reset
If you change the input values and then click the "Reset" button, the form-data will be
reset to the default values.
Radio buttons let a user select ONLY ONE of a limited number of choices:
Example
<p>Choose your favorite Web language:</p>
<form>
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label>
</form>
HTML
CSS
JavaScript
Checkboxes let a user select ZERO or MORE options of a limited number of choices.
Example
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label>
</form>
I have a bike
I have a car
I have a boat
Example
<input type="image" src="img_submit.gif" alt="Submit"
width="48" height="48">
Input Type Button
Example
<input type="button" onclick="alert('Hello World!')" value="Click Me!">
The <input type="color"> is used for input fields that should contain a color.
Depending on browser support, a color picker can show up in the input field.
Example
<form>
<label for="favcolor">Select your favorite color:</label>
<input type="color" id="favcolor" name="favcolor">
</form>
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">
</form>
You can also use the min and max attributes to add restrictions to dates:
Example
<form>
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02">
</form>
The <input type="datetime-local"> specifies a date and time input field, with no time
zone.
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="birthdaytime">Birthday (date and time):</label>
<input type="datetime-local" id="birthdaytime" name="birthdaytime">
</form>
The <input type="email"> is used for input fields that should contain an e-mail address.
Depending on browser support, the e-mail address can be automatically validated when
submitted.
Some smartphones recognize the email type, and add ".com" to the keyboard to match
email input.
Example
<form>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email">
</form>
The <input type="file"> defines a file-select field and a "Browse" button for file uploads.
Example
<form>
<label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile">
</form>
The <input type="hidden"> defines a hidden input field (not visible to a user).
A hidden field let web developers include data that cannot be seen or modified by users
when a form is submitted.
A hidden field often stores what database record that needs to be updated when the
form is submitted.
Note: While the value is not displayed to the user in the page's content, it is visible (and
can be edited) using any browser's developer tools or "View Source" functionality. Do not
use hidden inputs as a form of security!
Example
<form>
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="hidden" id="custId" name="custId" value="3487">
<input type="submit" value="Submit">
</form>
The <input type="month"> allows the user to select a month and year.
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="bdaymonth">Birthday (month and year):</label>
<input type="month" id="bdaymonth" name="bdaymonth">
</form>
The following example displays a numeric input field, where you can enter a value from
1 to 5:
Example
<form>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
</form>
Input Restrictions
Attribute Description
checked Specifies that an input field should be pre-selected when the page loads (for
type="checkbox" or type="radio")
You will learn more about input restrictions in the next chapter.
The following example displays a numeric input field, where you can enter a value from
0 to 100, in steps of 10. The default value is 30:
Example
<form>
<label for="quantity">Quantity:</label>
<input type="number" id="quantity" name="quantity" min="0" max="100" step="10" v
alue="30">
</form>
The <input type="range"> defines a control for entering a number whose exact value is
not important (like a slider control). Default range is 0 to 100. However, you can set
restrictions on what numbers are accepted with the min, max, and step attributes:
Example
<form>
<label for="vol">Volume (between 0 and 50):</label>
<input type="range" id="vol" name="vol" min="0" max="50">
</form>
The <input type="search"> is used for search fields (a search field behaves like a regular
text field).
Example
<form>
<label for="gsearch">Search Google:</label>
<input type="search" id="gsearch" name="gsearch">
</form>
The <input type="tel"> is used for input fields that should contain a telephone number.
Example
<form>
<label for="phone">Enter your phone number:</label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}">
</form>
The <input type="time"> allows the user to select a time (no time zone).
Depending on browser support, a time picker can show up in the input field.
Example
<form>
<label for="appt">Select a time:</label>
<input type="time" id="appt" name="appt">
</form>
Input Type Url
The <input type="url"> is used for input fields that should contain a URL address.
Depending on browser support, the url field can be automatically validated when
submitted.
Some smartphones recognize the url type, and adds ".com" to the keyboard to match url
input.
Example
<form>
<label for="homepage">Add your homepage:</label>
<input type="url" id="homepage" name="homepage">
</form>
The <input type="week"> allows the user to select a week and year.
Depending on browser support, a date picker can show up in the input field.
Example
<form>
<label for="week">Select a week:</label>
<input type="week" id="week" name="week">
</form>
Type: The type attribute defines the type of the form element that can be placed on a
form. Each value of the type produces different input element. They are as follows:
• Text: The text value creates a textbox which is used to enter the plain text such as
name, age etc.
• Password: Password works exactly like text box but the data entered is not readable
because each character is displayed as “*” (asterisk). The password is not encoded
and is sent to the server as plain text, hence it does not provide good security.
• Checkbox: This value creates a checkbox which allows the user to select more than
one option from a group of options.
• Radio: This value creates a radio button that is used for selecting a single option
from a group of options. These are always grouped elements with same name but
different values.
• Submit: This value creates a submit button that is used for sending the data entered
in the form to the web server.
• Reset: This value creates a reset button that clears the data entered in the form i.e.
when we click the reset button, all the form elements will be bought to default state.
• Image: This value is used to place a picture on the form instead of a button.
Name: The name attribute is used to give a name for a particular form element or group.
Value: The value attribute is used to define a default value for the form elements.
Size: The size attribute is used to define the displaying size of form elements like textbox
and password fields.
Maxlength: This attribute defines the maximum number of characters that can be
entered in a textbox or password filed.
Checked: This value can be used to select a default option from checkboxes and radio
buttons.
Src: This is used to define the path of image file.
Align: This used to align the image to the top, bottom, right, left, middle.
3) Select Tag: A select tag is used for creating a list box that contains a list of options. We can
select a single option or multiple options from the list box (by using MULTIPLE). The option
tag has SELECTED attribute that allows default selection of the option.
Syntax: <select name=” list box name” size=”value” multiple>
<option value=” list option value”> Option1
..........
..........
<option selected>OptionN
</select>
E.g. <select name=” games” size=”3” multiple>
<option>cricket
<option>football
<option>tennis
<option selected>volleyball
</select>
4) Textarea Tag: The textarea tag is used for create large text boxes that allow to enter text in
multiple lines. The rows and cols attributes are used for specifying the number of displaying
rows and columns in the textarea.
Syntax: <textarea rows=”value” cols=”value” maxlength=”value>
Default Text
</textarea>
E.g.<textarea rows=”5” cols=”3” maxlength=”100”>
....... ..
</textarea>
UNIT-V
Cascading Style Sheets
Introduction:
Web pages which are available over internet can be accessed by the user through many
devices like computers, mobile phones or televisions which can display text, images, and
table’s etc. Because of this reason, web pages should be designed in such a way that they can
be accessed and viewed by any interactive device. Html with its tags has no facilities to design
such kind of web pages so such web pages can be designed by using style sheets along with
html tags.
A style sheet is simply a set of formatting instructions that can be applied
to desired text or content on the web page. HTML is used to structure content whereas CSS
is used for formatting structured content. Styles can be cascaded i.e., default formats or
properties can be over ridden by using styles.
Note: Some old browsers may not support all the styles. This is the reason why designers
(programmers) should be careful while designing web pages by using styles.
Using Styles:
CSS is a style language that defines layout of HTML documents. There are three ways to
apply styles to an html document:
1) As an Attribute
(In-Line Style Sheets)
2) As a Tag
3) As an External File (External Style Sheets)
1) As an Attribute:
Inline style sheets can be applied using style attribute that can be applied for a specific
html tag like <h1>, <p> and <hr> etc. For example, to define a desired style for the heading
tag <h1>, we can use the following code:
<h1 style =”background-color: blue;
color: white;
text-align: center”>
-------------------------------
</h1>
In the above example, the default format of <h1> is over reddening by style attribute
and these properties will be applied only to the content of heading tag <h1>.
2) As a Tag:
Inline style sheets can also be applied using <style> tag within the HEAD section that
can be applied to the whole document. For example, to define a desired style for the paragraph
tag <p>, we can use the following code:
<head>
<style>
p { background-color: blue;
color: green;
letter-spacing: 10
}
</style>
</head>
In the above example, properties which were defined will be applied to the whole
document i.e., to the content in every paragraph tag of that particular document.
3) As an External File:
An external style sheet is a text file with an extension .CSS. All the properties and
values of styles are placed in these external style sheets. Then they can be linked with multiple
documents by using the <link> tag. For example, to define a desired style for the heading tag
<h1> in multiple documents like page1.html, page2.html and page3.html, we can use the
following steps:
Step-1: Declaration of properties or creation of CSS file:
h1 {background-color: blue;
color: green;
border-size: 5}
Save the above code with a file name and .css extension.
Ex: mystyles.css
Step-2: Link mystyles.css to page1.html, page2.html and page3.html by using
<link> tag. The syntax of link tag is as follows:
<link rel=”stylesheets”
type=”text/css”
href=”url or path of css file“>
Ex: <link rel =”style sheet “
type=”text/css”
href=”mystyles.css”>
Defining Own Styles:
Styles are defined by simple rules. We can declare single or multiple sets of styles which
can be linked to a particular content in different situations. When we define more number of
styles, there will be a chance that they may cascade (override) with each other.
Rules of Styles:
A style has two parts: SELECTOR and a SET OF DECLARATIONS enclosed
within flower brackets “{ }”. The selector is used to create a link between rule and tag.
Declaration has two parts known as PROPERTY and VALUE which are separated with a
colon (:) and each property colon value pair must be separated with a semicolon (;). Selector
can be placed into classes, so that content of a tag can be formatted with different styles.
Declarations using selector uses the following format:
selector {property1: value1;
Property2: value2;
------------------;
property n: value n;
}
Ex: h1 {background-color: blue;
color: white; letter-spacing: 10
}
Classes:
Generally by using selectors we can assign common properties to the content of a
particular tag, But to use a set of declarations in different tags or multiple sets of declarations
in a single tag at different places we must use classes. These classes can be defined in two
ways:
a) Using selector and class name to define properties, it uses the following format:
selector.classname {property1: value1;
property2: value2;
“
“
“
property n: value n
}
<selector class =” classname”>
-------------------------------
</selector>
Ex: h1.mystyle {background-color: blue;
color: green;
border-color: blue
}
<h1 class =”mystyle” > OH GOD! </h1>
In the above example, the style s1 is used by more than one type of tag (h1,p) ,
as well as paragraph tag used more than one style (s1 & s2 ) at different places.
Properties and Values in Styles:
A number of properties are available to format content on the web page using styles.
We can change the web page appearance by using different properties related to fonts, colors,
text, boxes etc., Styles with appropriate and limited number of properties make the web page
more attractive. The following are some of the mostly used properties:
• Properties related to fonts
• Properties related to backgrounds and colors
• Properties related to text
• Properties related to boxes
Properties related to Fonts:
Font-Family: This property is used to assign a desired font name to the text. The values to the
font-family property are font-family name and generic family name (optional). Most of the
browsers support font family names and all the browsers support generic family names. We
can include more than one font name, among this list. The font name that can be recognized by
browser will be considered. The format of font-family is:
Syntax: font-family:<family name>[<generic family name>]\
Ex: font-family:”Verdana”, “Times New Roman”, “Arial”;
Font-Style: This property defines the displaying style of text i.e., Normal, Italic, Oblique
Syntax: font-style:normal|italic|oblique
Ex: font-style:italic;
Font-Weight: This property defines thickness of the text i.e., normal, bold, lighter etc. We can
also give absolute weight in terms of pixels.
Syntax: font-weight:normal|lighter|bold|bolder|100|200
Ex-1: font-weight:bolder;
Ex-2: font-weight: 200;
Font-Size: This property is used to define the size of the text. This size can be in terms of
relative or absolute.
Syntax:font-size:small|medium|large|smaller|larger|value in terms of pixels
In the above syntax relative size includes smaller, larger and absolute size includes small,
medium, large etc.
Ex-1: font-size:large
Ex-2: font-size:100;
Properties related to Backgrounds & Colors:
Colors: By using this property we can assign a desired color to a particular text or block of text.
The value to this property should be color name or color code.
Syntax: color:colorname|color code
Ex-1: color:red;
Ex-2: color:#ff0000;
Background-Color: By using this property we can assign a color as background to desired
content or area. The value to this property should be color name or color code or transparent.
Syntax: background-color:colorname|colorcode|transparent
Ex: background-color:blue;
Background-Image: Instead of color, we can set an image as a background to desired content
or area using background image property.
Syntax: background-image:URL (path of image)
Ex: Background-image:URL(microsoft.jpg)
Left and Right Properties: These properties define the top left corners of the layer.
Width and Height: These properties define the size of layer in terms of width i.e,, amount of
spaces needed to display content.
Ex: <div style=”z-index:2;
position:absolute;
left:10;
top:10;
width:300;
height:200;”>
----------------
----------------
</div>