WEB Technology: VM - Aasc
WEB Technology: VM - Aasc
WebTechnology WebTechnology
WebTechnologyWEB
TECHNOLOGYWebTechnology
WebTechnologyWebTechnology
WebTechnology WebTechnology
VM | AASC
WebTechnology WebTechnology
WebTechnology WebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
VM & VP AASC Web Technology 1
&
WebTechnologyWebTechnology
WebTechnologyWebTechnology
WebTechnologyWebTechnology
1. MODULE-I
2. MODULE - II
VM & VP | AASC
VM & VP AASC Web Technology 2
&
2.1.12. Image and hyperlink anchors
2.1.13. Image maps
2.1.14. Tables
2.1.15. Frames 2.1.16.
Forms.
3. MODULE – III
4. MODULE - IV
5. MODULE-V
VM & VP | AASC
VM & VP AASC Web Technology 3
&
MODULE-I
• Internet is a global network that connects billions of computers across the world with each
other and to the World Wide Web.
• It uses standard internet protocol suite (TCP/IP) to connect billions of computer users
worldwide.
• It is set up by using cables such as optical fibres and other wireless and networking
technologies.
• At present, internet is the fastest mean of sending or exchanging information and data
between computers across the world.
• It is believed that the internet was developed by "Defence Advanced Projects Agency"
(DARPA) department of the United States. And, it was first connected in 1969.
Generally speaking, the Internet may be used to exchange information with people all over the
world, communicate across great distances, and locate information or answers fast on almost any
subject.
▪ Online dating
▪ Online gaming
▪ Research
▪ Reading electronic newspapers and magazines ▪ Online shopping or
e-commerce.
▪ Online discussion groups and forums
VM & VP | AASC
VM & VP AASC Web Technology 5
&
media apps while doing nothing. Rather than squandering time, one
should use that time to do something useful and even more productive.
• Bad impacts on health: You can get health related issues if you spend too
much time online; your body needs outside activities, exercise, and many
other things. If you look at the screen for a long time, it causes negative
effects on the eyes.
• Cyber Crimes: These days, crimes including cyber bullying, spam, viruses,
hacking, and data theft are increasing day by day. Cybercriminals can
quickly break into your system, which store all of your private information.
• Effects on children: The constant watching of videos and playing games on
the Internet by young children is bad for their social and overall personality
development.
• Bullying and spreading negativity: Social media applications have
provided a free tool to all those people who regularly attempt to spread
negativity with really repulsive and humiliating comments and try to bully
each other, which are wrong and do bad impact on society.
The World Wide Web is abbreviated as WWW and is commonly known as the web.
The WWW was initiated by CERN (European library for Nuclear Research) in 1989. WWW
can be defined as the collection of different websites around the world, containing different
information shared via local servers (or computers).
1.1.2.1. History:
VM & VP | AASC
VM & VP AASC Web Technology 6
&
▪ Here the browser displays a web page on the client machine when the
user clicks on a line of text that is linked to a page on abd.com; the
browser follows the hyperlink by sending a message to the abd.com
server asking for the page.
▪ The web browser is application software to explore www (World Wide Web). It provides an
interface between the server and the client and requests to the server for web documents
and services.
▪ Google Chrome, Microsoft Edge, Mozilla Firefox, and Safari are examples of web browsers.
▪ The first web browser Worldwide Web was invented in the year of 1990 by Tim BernersLee.
Later, it becomes Nexus.
▪ In the year of 1993, a new browser Mosaic was invented by Mark Andreessen and their
team. It was the first browser to display text and images at a time on the device screen. He
also invents another browser Netscape in 1994.
▪ Next year Microsoft launched a web browser Internet Explorer which was already installed in
the Windows operating system. After this many browsers were invented with various
features like Mozilla Firefox, Google Chrome, Safari, Opera, etc.
▪ A web browser helps us find information anywhere on the internet. It is installed on the
client computer and requests information from the web server such a type of working model
is called a client-server model.
Client-server model
▪ The browser receives information through HTTP protocol. In which transmission of data is
defined. When the browser received data from the server, it is rendered in HTML to
userreadable form and, information is displayed on the device screen.
▪ When we visited any website over the internet our web browser stores information about us
in small files called cookies. Cookies are designed to remember stateful information about
our browsing history.
VM & VP | AASC
VM & VP AASC Web Technology 8
&
▪ Some more cookies are used to remember about us like our interests, our browsing patterns,
etc. Websites show us ads based on our interests using cookies.
▪ Google Chrome: Developed by Google, Chrome is one of the most widelyused web browsers
in the world, known for its speed and simplicity.
▪ Mozilla Firefox: Developed by the Mozilla Foundation, Firefox is an opensource browser that
is known for its privacy features and customization options.
▪ Apple Safari: Developed by Apple, Safari is the default browser on Mac and iOS devices and
is known for its speed and integration with other Apple products.
▪ Microsoft Edge: Developed by Microsoft, Edge is the default browser on Windows 10 and is
known for its integration with other Microsoft products and services.
▪ Opera: Developed by Opera Software, Opera is a web browser that is known for its speed
and built-in VPN feature.
▪ Brave: Developed by Brave Software, Brave is a web browser that is focused on privacy and
security and blocks third-party ads and trackers by default.
▪ Tor Browser: Developed by The Tor Project, Tor Browser is a web browser that is designed for
anonymous web browsing and is based on Mozilla Firefox.
▪ An HTTP client sends an HTTP request to a server in the form of a request message which
includes following format:
1. A Request-line
2. Zero or more header (General | Request |Entity) fields followed by CRLF (“Carriage
3. An empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header
fields
4. Optionally a message-body
VM & VP | AASC
VM & VP AASC Web Technology 9
&
▪ The following sections explain each of the entities used in an HTTP request message.
1.1.1.1. Request-Line
▪ The Request-Line begins with a method token, followed by the Request-URI and the
protocol version, and ending with CRLF. The elements are separated by space SP
characters.
1
GET
The GET method is used to retrieve information from the given server using a given URI.
Requests using GET should only retrieve data and should have no other effect on the data.
2 HEAD
Same as GET, but it transfers the status line and the header section only.
VM & VP | AASC
VM & VP AASC Web Technology 10
&
3
POST
A POST request is used to send data to the server, for example, customer information, file
upload, etc. using HTML forms.
4 PUT
Replaces all the current representations of the target resource with the uploaded content.
5 DELETE
Removes all the current representations of the target resource given by URI.
6
CONNECT
7 OPTIONS
8 TRACE
Performs a message loop back test along with the path to the target resource.
1.1.1.1.2. Request-URI
The Request-URI is a Uniform Resource Identifier and identifies the resource upon
which to apply the request. Following are the most commonly used forms to specify
an URI:
VM & VP | AASC
VM & VP AASC Web Technology 11
&
S.N.
1
The asterisk * is used when an HTTP request does not apply to a particular resource, but
to the server itself, and is only allowed when the method used does not necessarily apply
to a resource. For example:
OPTIONS * HTTP/1.1
2
The absoluteURI is used when an HTTP request is being made to a proxy. The proxy is
requested to forward the request or service from a valid cache, and return the response.
For example:
3 The most common form of Request-URI is that used to identify a resource on an origin
server or gateway. For example, a client wishing to retrieve a resource directly from the
origin server would create a TCP connection to port 80 of the host "www.w3.org" and
send the following lines:
▪ You can introduce your custom fields in case you are going to write your own custom
Client and Web Server.
1.1.1.3. Examples of Request Message:
▪ Now let's put it all together to form an HTTP request to fetch hello.htm page from the
web server running on tutorialspoint.com
▪ Here we are not sending any request data to the server because we are fetching a plain
HTML page from the server. Connection is a general-header, and the rest of the headers
are request headers. The following example shows how to send form data to the server
using request message body:
licenseID=string&content=string&/paramsXML=string
▪ Here the given URL /cgi-bin/process.cgi will be used to process the passed data and
accordingly, a response will be returned. Here content-type tells the server that the
passed data is a simple web form data and length will be the actual length of the data
put in the message body. The following example shows how you can pass plain XML to
your web server:
▪ After receiving and interpreting a request message, a server responds with an HTTP
response message:
1. A Status-line
VM & VP | AASC
VM & VP AASC Web Technology 14
&
5. Optionally a message-body
▪ A Status-Line consists of the protocol version followed by a numeric status code and
its associated textual phrase. The elements are separated by space SP characters.
▪ A server supporting HTTP version 1.1 will return the following version information:
HTTP-Version = HTTP/1.1
▪ The Status-Code element is a 3-digit integer where first digit of the Status-Code defines
the class of response and the last two digits do not have any categorization role. There
are 5 values for the first digit:
VM & VP | AASC
VM & VP AASC Web Technology 15
&
1
1xx: Informational
2 2xx: Success
3 3xx: Redirection
▪ HTTP status codes are extensible and HTTP applications are not required to understand
the meaning of all registered status codes. A list of all the status codes has been given
in a separate chapter for your reference.
1.1.2.2. Response Header Fields
VM & VP | AASC
VM & VP AASC Web Technology 16
&
▪ You can introduce your custom fields in case you are going to write your own custom
Web Client and Server.
1.1.2.3. Examples of Response Message
▪ Now let's put it all together to form an HTTP response for a request to fetch the hello.htm
page from the web server running on tutorialspoint.com
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
Content-Length: 88
Content-Type: text/html
Connection: Closed
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
▪ The following example shows an HTTP response message displaying error condition
when the web server could not find the requested page:
▪ Following is an example of HTTP response message showing error condition when the
web server encountered a wrong HTTP version in the given HTTP request:
2. MODULE - II
VM & VP | AASC
VM & VP AASC Web Technology 18
&
MODULE-II
</body>
</html>
Example Explained
• The <!DOCTYPE html> declaration defines that this document is an HTML5 document
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the HTML page
• The <title> element specifies a title for the HTML page (which is shown in the browser's
title bar or in the page's tab)
• The <body> element defines the document's body, and is a container for all the visible
contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
• The <h1> element defines a large heading
• The <p> element defines a paragraph
VM & VP | AASC
VM & VP AASC Web Technology 19
&
VM & VP | AASC
VM & VP AASC Web Technology 20
&
2.1.1.7. Advantages:
2.1.1.8. Disadvantages:
▪ HTML can only create static web pages. For dynamic web pages,
other languages have to be used.
▪ A large amount of code has to be written to create a simple web
page.
▪ The security feature is not good.
<!DOCTYPE html>
Examples
<!DOCTYPE html>
<!DocType html>
VM & VP | AASC
VM & VP AASC Web Technology 21
&
<!Doctype html>
<!doctype html>
▪ The <html> tag is the container for all other HTML elements (except for
the <!DOCTYPE> tag).
Note: You should always include the lang attribute inside the <html> tag, to
declare the language of the Web page. This is meant to assist search engines
and browsers.
▪ The <title> tag defines the title of the document. The title must be
textonly, and it is shown in the browser's title bar or in the page's tab.
▪ The contents of a page title are very important for search engine
optimization (SEO)! The page title is used by search engine algorithms to
decide the order when listing pages in search results.
Note: You can NOT have more than one <title> element in an HTML document.
2.1.2.4. Body Tag
VM & VP | AASC
VM & VP AASC Web Technology 22
&
Definition and Usage
• The <head> element is a container for metadata (data about data) and is
placed between the <html> tag and the <body> tag.
• Metadata is data about the HTML document. Metadata is not displayed.
• Metadata typically define the document title, character set, styles,
scripts, and other Meta information.
• The following elements can go inside the <head> element:
▪ The <br> tag is an empty tag which means that it has no end tag.
Note: Use the <br> tag to enter line breaks, not to add space between
paragraphs.
VM & VP | AASC
VM & VP AASC Web Technology 23
&
Example
▪ The <center> tag in HTML is used to set the alignment of text into the center.
This tag is not supported in HTML5. CSS’s property is used to set the alignment
of the element instead of the center tag in HTML5.
Syntax:
HTML Lists are used to specify lists of information. All lists may contain one or more list
elements. There are three different types of HTML lists:
HTML Ordered List or Numbered List displays elements in numbered format. The
HTML ol tag is used for ordered list. We can use ordered list to represent items
either in numerical order format or alphabetical order format, or any format where
an order is emphasized. There can be different types of numbered list:
To represent different ordered lists, there are 5 types of attributes in <ol> tag.
VM & VP | AASC
VM & VP AASC Web Technology 24
&
Description
Type
Type "1" This is the default type. In this type, the list items are numbered with numbers.
Type "I" In this type, the list items are numbered with upper case roman numbers.
Type "i" In this type, the list items are numbered with lower case roman numbers.
Type "A" In this type, the list items are numbered with upper case letters.
Type "a" In this type, the list items are numbered with lower case letters.
<ol>
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
1. HTML
2. Java
3. JavaScript
4. SQL
VM & VP | AASC
VM & VP AASC Web Technology 25
&
a) ol type="I"
<ol type="I">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
I. HTML
II. Java
b) ol type="i"
<ol type="i">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
i. HTML
ii. Java
iii. JavaScript
iv. SQL
c) ol type="A"
<ol type="A">
VM & VP | AASC
VM & VP AASC Web Technology 26
&
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
A. HTML
B. Java
C. JavaScript
D. SQL
d) ol type="a"
<ol type="a">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
a. HTML
b. Java
c. JavaScript
d. SQL
Start attribute
The start attribute is used with ol tag to specify from where to start the list items.
<ol type="1" start="5"> : It will show numeric values starting with "5".
<ol type="A" start="5"> : It will show capital alphabets starting with "E".
<ol type="a" start="5"> : It will show lower case alphabets starting with "e".
VM & VP | AASC
VM & VP AASC Web Technology 27
&
<ol type="I" start="5"> : It will show Roman upper case value starting with "V".
<ol type="i" start="5"> : It will show Roman lower case value starting with "v".
v. HTML
vi. Java
vii. JavaScript
viii. SQL
Reversed Attribute:
This is a Boolean attribute of HTML <ol> tag, and it is new in HTML5 version. If you use the reversed
attribute with tag then it will numbered the list in descending order (7, 6, 5, 4......1).
Example:
<ol reversed>
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ol>
Output:
HTML Unordered List or Bulleted List displays elements in bulleted format. We can
use unordered list where we do not need to display items in any particular order.
The HTML ul tag is used for the unordered list. There can be 4 types of bulleted
list:
VM & VP | AASC
VM & VP AASC Web Technology 28
&
• disc
• circle
• square
• none
To represent different ordered lists, there are 4 types of attributes in <ul> tag.
Type Description
Type "disc" This is the default style. In this style, the list items are marked with bullets.
Type "circle" In this style, the list items are marked with circles.
Type "square" In this style, the list items are marked with squares.
Type "none" In this style, the list items are not marked .
<ul>
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ul>
Output:
• HTML
• Java
• JavaScript
• SQL
VM & VP | AASC
VM & VP AASC Web Technology 29
&
a) ul type="circle"
<ul type="circle">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ul>
Output:
• HTML
• Java
• JavaScript
• SQL
b) ul type="square"
<ul type="square">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ul>
Output:
• HTML
• Java
• JavaScript
• SQL
c) ul type="none"
<ul type="none">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ul>
Output:
VM & VP | AASC
VM & VP AASC Web Technology 30
&
• HTML
• Java
• JavaScript
• SQL
Note: The type attribute is not supported in HTML5; instead of type you can use CSS property of list-
style-type. Following is the example to show the CSS property for ul tag.
Eg Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>The type attribute with CSS property</h2>
<ul style="list-style-type: square;">
<li>HTML</li>
<li>Java</li>
<li>JavaScript</li>
<li>SQL</li>
</ul>
</body>
</html>
Output:
VM & VP | AASC
VM & VP AASC Web Technology 31
&
Output:
HTML
is a markup language
Java is a programming language and platform
JavaScript is a scripting
language
SQL is a query language
VM & VP | AASC
VM & VP AASC Web Technology 32
&
HTML Nested List
A list within another list is termed as nested list. If you want a bullet list inside a
numbered list then such type of list will called as nested list.
Code:
<!DOCTYPE html>
<html>
<head>
<title>Nested list</title>
</head>
<body>
<p>List of Indian States with thier capital</p>
<ol>
<li>Delhi
<ul>
<li>NewDelhi</li>
</ul>
</li>
<li>Haryana
<ul>
<li>Chandigarh</li>
</ul>
</li>
<li>Gujarat
<ul>
<li>Gandhinagar</li>
</ul>
</li>
<li>Rajasthan
<ul>
<li>Jaipur</li>
</ul>
</li>
<li>Maharashtra
<ul>
<li>Mumbai</li>
</ul>
</li>
<li>Uttarpradesh
VM & VP | AASC
VM & VP AASC Web Technology 33
&
<ul>
<li>Lucknow</li></ul>
</li>
</ol>
</body>
</html>
Output:
HTML Image
• HTML img tag is used to display image on the web page. HTML img tag is
an empty tag that contains attributes only, closing tags are not used in
HTML image element.
• Let's see an example of HTML image.
Output:
• The src and alt are important attributes of HTML img tag. All attributes of
HTML image tag are given below.
VM & VP | AASC
VM & VP AASC Web Technology 34
&
1) Src
2) Alt
The alt attribute defines an alternate text for the image, if it can't be
displayed. The value of the alt attribute describes the image in words. The
alt attribute is considered good for SEO prospective.
3) Width
4) Height
It h3 the height of the image. The HTML height attribute also supports iframe,
image and object elements. It is not recommended now. You should apply
CSS in place of height attribute.
Example:
<img src="animal.jpg" height="180" width="300" alt="animal image">
Output:
Note: Always try to insert the image with height and width, else it may flicker while displaying on
webpage.
VM & VP | AASC
VM & VP AASC Web Technology 35
&
Use of alt attribute
• We can use alt attribute with tag. It will display an alternative text in case
if image cannot be displayed on browser. Following is the example for alt
attribute:
Output:
• To insert an image in your web, that image must be present in your same
folder where you have put the HTML file. But if in some case image is
available in some other directory then you can access the image like this:
Note: If src URL will be incorrect or misspell then it will not display your image on web page, so try to
put correct URL.
We can also link an image with other page or we can use an image as a link. To do this, put
<img> tag inside the <a> tag.
Example:
<a href="https://www.javatpoint.com/what-isrobotics"><img
src="robot.jpg" height="100" width="100"></a> Output:
2.1.9. Frames
• HTML <frame> tag define the particular area within an HTML file where another HTML
web page can be displayed.
• A <frame> tag is used with <frameset>, and it divides a webpage into multiple sections
or frames, and each frame can contain different web pages.
Note: Do not use HTML <frame> tag as it is not supported in HTML5, instead you
can use <iframe> or <div> with CSS to achieve similar effects in HTML.
Display Block
Usage Frames
Example 1
Create Vertical frames:
<!DOCTYPE html>
<html>
<head>
<title>Frame tag</title>
</head>
<frameset cols="25%,50%,25%">
<frame src="frame1.html" >
<frame src="frame2.html">
<frame src="frame3.html">
</frameset>
</html>
Output:
Frame1.html
<!DOCTYPE html>
<html>
<head>
<style>
div{
background-color: #7fffd4;
height: 500px;
}
</style>
</head>
<body>
<div>
<h2>This is first frame</h2>
</div>
</body>
</html>
Frame2.html
<!DOCTYPE html>
<html>
VM & VP | AASC
VM & VP AASC Web Technology 37
&
<head>
<style>
div{
background-color: #2f4f4f;
height: 500px;
}
</style>
</head>
<body>
<div>
<h2>This is Second frame</h2>
</div>
</body>
</html>
Frame3.html
<!DOCTYPE html>
<html>
<head>
<style>
div{
background-color: #c1ffc1;
height: 500px; }
</style>
</head>
<body>
<div>
<h2>This is Third frame</h2>
</div>
</body>
</html>
Output:
VM & VP | AASC
VM & VP AASC Web Technology 38
&
• An HTML form is a section of a document which contains controls such as text fields, password
fields, checkboxes, radio buttons, submit button, menus etc.
• An HTML form facilitates the user to enter data that is to be sent to the server for processing
such as name, email address, password, phone number, etc. .
HTML forms are required if you want to collect some data from of the site visitor.
For example: If a user want to purchase some items on internet, he/she must fill the form such as
shipping address and credit/debit card details so that item can be sent to the given address.
Tag Description
VM & VP | AASC
VM & VP AASC Web Technology 39
&
Tag Description
The HTML <form> element provide a document section to take input from user. It provides various
interactive controls for submitting information to web server such as text field, text area, password
field, etc.
Note: The <form> element does not itself create a form but it is container to contain all required form
elements, such as <input>, <label>, etc.
Syntax:
<form>
//Form elements </form>
2.1.10.2. HTML <input> element
VM & VP | AASC
VM & VP AASC Web Technology 40
&
The HTML <input> element is fundamental form element. It is used to create form fields, to take input
from user. We can apply different input filed to gather different information form user. Following is the
example to show the simple text input.
Example:
<body>
<form>
Enter your name <br>
<input type="text" name="username">
</form>
</body>
Output:
The type="text" attribute of input tag creates textfield control also known as single line textfield
control. The name attribute is optional, but it is required for the server side component such as JSP,
ASP, PHP etc.
<form>
First Name: <input type="text" name="firstname"/> <br/>
Last Name: <input type="text" name="lastname"/> <br/>
</form>
Output:
Note: If you will omit 'name' attribute then the text filed input will not be submitted to server.
The <textarea> tag in HTML is used to insert multiple-line text in a form. The size of <textarea> can be
specify either using "rows" or "cols" attribute or by CSS.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Form in HTML</title>
</head> <body>
<form>
VM & VP | AASC
VM & VP AASC Web Technology 41
&
Enter your address:<br>
<textarea rows="2" cols="20"></textarea>
</form>
</body>
</html>
Output:
It is considered better to have label in form. As it makes the code parser/browser/user friendly.
If you click on the label tag, it will focus on the text control. To do so, you need to have for attribute in
label tag that must be same as id attribute of input tag.
NOTE: It is good to use <label> tag with form, although it is optional but if you will use it, then it will provide
a focus when you tap or click on label tag. It is more worthy with touchscreens.
<form>
<label for="firstname">First Name: </label> <br/>
<input type="text" id="firstname" name="firstname"/> <br/>
<label for="lastname">Last Name: </label>
<input type="text" id="lastname" name="lastname"/> <br/>
</form>
Output:
<form>
<label for="password">Password: </label>
<input type="password" id="password" name="password"/> <br/>
</form>
Output:
VM & VP | AASC
VM & VP AASC Web Technology 42
&
2.1.10.7. HTML 5 Email Field Control
The email field in new in HTML 5. It validates the text for correct email address. You must use @ and
. in this field.
<form>
<label for="email">Email: </label>
<input type="email" id="email" name="email"/> <br/>
</form>
Note: If we will not enter the correct email, it will display error like:
The radio button is used to select one option from multiple options. It is used for selection of gender,
quiz questions etc.
If you use one name for all the radio buttons, only one radio button can be selected at a time.
Using radio buttons for multiple options, you can only choose a single option at a time.
<form>
<label for="gender">Gender: </label>
<input type="radio" id="gender" name="gender" value="male"/>Male
<input type="radio" id="gender" name="gender" value="female"/>Female <br/>
</form>
Checkbox Control
The checkbox control is used to check multiple options from given checkboxes.
<form>
Hobby:<br>
<input type="checkbox" id="cricket" name="cricket" value="cricket"/>
<label for="cricket">Cricket</label> <br>
<input type="checkbox" id="football" name="football" value="football"/>
<label for="football">Football</label> <br>
<input type="checkbox" id="hockey" name="hockey" value="hockey"/>
VM & VP | AASC
VM & VP AASC Web Technology 43
&
<label for="hockey">Hockey</label>
</form>
Note: These are similar to radio button except it can choose multiple options at a time and radio button can
select one button at a time, and its display.
Output:
HTML <input type="submit"> are used to add a submit button on web page. When user clicks on
submit button, then form get submit to the server.
Syntax:
The value attribute can be anything which we write on button on web page.
Example:
<form>
<label for="name">Enter name</label><br>
<input type="text" id="name" name="name"><br>
<label for="pass">Enter Password</label><br>
<input type="Password" id="pass" name="pass"><br>
<input type="submit" value="submit">
</form>
Output:
The <fieldset> element in HTML is used to group the related information of a form. This element is
used with <legend> element which provide caption for the grouped elements.
Example:
VM & VP | AASC
VM & VP AASC Web Technology 44
&
<form>
<fieldset>
<legend>User Information:</legend>
<label for="name">Enter name</label><br>
<input type="text" id="name" name="name"><br>
<label for="pass">Enter Password</label><br>
<input type="Password" id="pass" name="pass"><br>
<input type="submit" value="submit">
</fieldset> lt;/form>
Output:
<!DOCTYPE html>
<html>
<head>
<title>Form in HTML</title>
</head>
<body>
<h2>Registration form</h2>
<form>
<fieldset>
<legend>User personal information</legend>
<label>Enter your full name</label><br>
<input type="text" name="name"><br>
<label>Enter your email</label><br>
<input type="email" name="email"><br>
<label>Enter your password</label><br>
<input type="password" name="pass"><br>
<label>confirm your password</label><br>
<input type="password" name="pass"><br>
<br><label>Enter your gender</label><br>
<input type="radio" id="gender" name="gender" value="male"/>Male <br>
<input type="radio" id="gender" name="gender" value="female"/>Female <br/>
<input type="radio" id="gender" name="gender" value="others"/>others <br/>
<br>Enter your Address:<br>
VM & VP | AASC
VM & VP AASC Web Technology 45
&
<textarea></textarea><br>
<input type="submit" value="sign-up">
</fieldset>
</form>
</body>
</html>
Output:
<form action="#">
<table>
<tr>
<td class="tdLabel"><label for="register_name" class="label">Enter name:</label></td>
<td><input type="text" name="name" value="" id="register_name" style="width:160px"/></td>
</tr>
<tr>
<td class="tdLabel"><label for="register_password" class="label">Enter password:</label></td>
<td><input type="password" name="password" id="register_password" style="width:160px"/></td>
</tr>
<tr>
<td class="tdLabel"><label for="register_email" class="label">Enter Email:</label></td>
<td
><input type="email" name="email" value="" id="register_email" style="width:160px"/></td>
</tr>
<tr>
<td class="tdLabel"><label for="register_gender" class="label">Enter Gender:</label></td>
<td>
<input type="radio" name="gender" id="register_gendermale" value="male"/>
<label for="register_gendermale">male</label>
<input type="radio" name="gender" id="register_genderfemale" value="female"/> <label
for="register_genderfemale">female</label>
</td>
</tr>
<tr>
<td class="tdLabel"><label for="register_country" class="label">Select Country:</label></td>
VM & VP | AASC
VM & VP AASC Web Technology 46
&
<td><select name="country" id="register_country" style="width:160px">
<option value="india">india</option>
<option value="pakistan">pakistan</option>
<option value="africa">africa</option>
<option value="china">china</option>
<option value="other">other</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><div align="right"><input type="submit" id="register_0" value="register"/>
</div></td>
</tr>
</table>
</form>
3. MODULE - III
MODULE-III
• DHTML stands for Dynamic Hypertext Mark-up language i.e., Dynamic HTML.
• Dynamic HTML is not a mark-up or programming language but it is a term that combines
the features of various web development technologies for creating the web pages dynamic
and interactive.
• The DHTML application was introduced by Microsoft with the release of the 4th version of
IE
• HTML 4.0
• CSS
• JavaScript
• DOM.
HTML 4.0
HTML is a client-side markup language, which is a core component of the DHTML. It defines
the structure of a web page with various defined basic elements or tags.
CSS
CSS stands for Cascading Style Sheet, which allows the web users or developers for controlling
the style and layout of the HTML elements on the web pages.
JavaScript
JavaScript is a scripting language which is done on a client-side. The various browser supports
JavaScript technology. DHTML uses the JavaScript technology for accessing, controlling, and
manipulating the HTML elements. The statements in JavaScript are the commands which tell the
browser for performing an action.
DOM
DOM is the document object model. It is a w3c standard, which is a standard interface of
programming for HTML. It is mainly used for defining the objects and properties of all elements in
HTML.
Uses of DHTML
• It is used for designing the animated and interactive web pages that are developed in realtime.
• DHTML helps users by animating the text and images in their documents.
• It also allows the page authors for including the drop-down menus or rollover buttons.
automatically.
Features of DHTML
• It provides the facility for using the events, methods, and properties. And, also provides the
feature of code reusability.
2. It is used for developing and creating web 2. It is used for creating and designing the
pages. animated and interactive web sites or pages.
3. This markup language creates static web pages. 3. This concept creates dynamic web pages.
5. The files of HTML are stored with the .html or 5. The files of DHTML are stored with the .dhtm
.htm extension in a system. extension in a system.
6. A simple page which is created by a user 6. A page which is created by a user using the
without using the scripts or styles called as an HTML, CSS, DOM, and JavaScript technologies
HTML page. called a DHTML page.
VM & VP | AASC
VM & VP AASC Web Technology 49
&
7. This markup language does not need database 7. This concept needs database connectivity
connectivity. because it interacts with users.
Why CSS?
• CSS saves time: You can write CSS once and reuse the same sheet in multiple HTML pages.
• Easy Maintenance: To make a global change simply change the style, and all elements in all
the webpages will be updated automatically.
• Search Engines: CSS is considered a clean coding technique, which means search engines
won’t have to struggle to “read” its content.
• Superior styles to HTML: CSS has a much wider array of attributes than HTML, so you can give
a far better look to your HTML page in comparison to HTML attributes.
• Offline Browsing: CSS can store web applications locally with the help of an offline cache. Using
this we can view offline websites. CSS versions release
years:
CSS Syntax:
CSS comprises style rules that are interpreted by the browser and then applied to the corresponding
elements in your document. A style rule set consists of a selector and declaration block.
1. Selector: A selector in CSS is used to target and select specific HTML elements to apply styles to.
2. Declaration: A declaration in CSS is a combination of a property and its corresponding value.
Selector -- h1
Declaration -- {color:blue;font size:12px;}
Let’s see how our page looks with & without CSS :
Before CSS: In this example, we have not added any CSS. Html
VM & VP | AASC
VM & VP AASC Web Technology 50
&
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<main>
<h1>HTML Page</h1>
<p>This is a basic web page.</p>
</main>
</body>
</html>
Output:
[Without CSS]
After CSS: In this example, we added some CSS styling inside the HTML code only to show how CSS
makes a dull HTML page look beautiful.
Html
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<style> main {
width: 600px;
height: 200px;
padding: 10px;
background: beige;
}
h1 {
color: olivedrab;
border-bottom: 1px dotted darkgreen;
}
p{
font-family: sans-serif;
color: orange;
}
</style>
</head>
<body>
<main>
<h1>My first Page</h1>
<p>This is a basic web page.</p>
</main> </body>
</html>
VM & VP | AASC
VM & VP AASC Web Technology 51
&
Output:
[With CSS]
✓ Inline CSS: Define CSS properties using style attribute in the HTML elements.
✓ Internal or Embedded CSS: Define CSS using <style> tag in <head> section.
✓ External CSS: Define all CSS property in a separate .css file, and then include the file with
Syntax:
Example:
<html>
<body>
</body>
</html> Output:
VM & VP | AASC
VM & VP AASC Web Technology 52
&
This paragraph is not affected.
o You cannot use quotations within inline CSS. If you use quotations the browser will
interpret this as an end of your style value.
o These styles cannot be reused anywhere else. o These styles are tough to be edited
because they are not stored at a single place. o It is not possible to style pseudo-
codes and pseudo-classes with inline CSS. o Inline CSS does not provide browser
cache advantages.
An internal style sheet may be used if one single HTML page has a unique style.
The internal style is defined inside the <style> element, inside the head section.
Example
Internal styles are defined within the <style> element, inside the <head> section of an HTML page:
<!DOCTYPE html>
<html>
<head>
<style> body {
background-color: linen;
}
h1 { color:
maroon; margin-
left: 40px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
• Each HTML page must include a reference to the external style sheet file inside the <link>
element, inside the head section.
VM & VP | AASC
VM & VP AASC Web Technology 53
&
Example
External styles are defined within the <link> element, inside the <head> section of an HTML page:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
• An external style sheet can be written in any text editor, and must be saved with a .css extension.
• The external .css file should not contain any HTML tags.
body {
background-color: lightblue;
}
h1 { color: navy;
margin-left: 20px;
}
Note: Do not add a space between the property value (20) and the unit (px):
Incorrect (space): margin -left: 20 px;
Correct (no space): margin-left: 20px;
1) CSS Syntax
VM & VP | AASC
VM & VP AASC Web Technology 54
&
• Each declaration includes a CSS property name and a value, separated by a colon.
• Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded
by curly braces.
2) CSS Selectors
CSS selectors are used to "find" (or select) the HTML elements you want to style.
The element selector selects HTML elements based on the element name.
Example
Here, all <p> elements on the page will be centre-aligned, with a red text color:
VM & VP | AASC
VM & VP AASC Web Technology 55
&
The id selector uses the id attribute of an HTML element to select a specific element.
The id of an element is unique within a page, so the id selector is used to select one unique element!
To select an element with a specific id, write a hash (#) character, followed by the id of the element.
Example
The CSS rule below will be applied to the HTML element with id="para1":
VM & VP | AASC
VM & VP AASC Web Technology 56
&
3. The CSS class Selector
• The class selector selects HTML elements with a specific class attribute.
• To select elements with a specific class, write a period (.) character, followed by the class name.
Example
In this example all HTML elements with class="center" will be red and center-aligned:
You can also specify that only specific HTML elements should be affected by a class.
Example
In this example only <p> elements with class="center" will be red and center-aligned:
VM & VP | AASC
VM & VP AASC Web Technology 57
&
The universal selector (*) selects all HTML elements on the page.
Example
• Look at the following CSS code (the h1, h2, and p elements have the same style definitions):
h1 { text-align:
center; color: red;
}
h2 { text-align:
center; color: red;
}
p{
text-align: center;
color: red;
}
• It will be better to group the selectors, to minimize the code. To group selectors,
separate each selector with a comma.
Example
In this example we have grouped the selectors from the code above:
VM & VP | AASC
VM & VP AASC Web Technology 58
&
3) CSS Comments:
• CSS comments are not displayed in the browser, but they can help document your source
code.
• Comments are used to explain the code, and may help when you edit the source code at
a later date.
• Comments are ignored by browsers.
• A CSS comment is placed inside the <style> element, and starts with /* and ends with */:
• From the HTML tutorial, you learned that you can add comments to your HTML source by
using the <!--...--> syntax.
Example
<!DOCTYPE html>
<html>
<head> <style> p { color: red; /* Set
text color to red */
}
</style>
</head>
<body>
<h2>My Heading</h2>
</body>
</html>
VM & VP | AASC
VM & VP AASC Web Technology 59
&
OUTPUT:
My Heading
Hello World!
Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.
In CSS, a color can be specified by using a predefined color name: CSS/HTML support 140 standard
color names.
<html>
<body>
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
</body>
</html>
OUTPUT:
Tomato
Orange
DodgerBlue
VM & VP | AASC
VM & VP AASC Web Technology 60
&
MediumSeaGreen
Gray
SlateBlue
Violet
5) CSS Background Color
<html>
<body>
<p style="background-color:Tomato;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod
tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut
aliquip ex ea commodo consequat. </p>
</body>
</html> OUTPUT:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad
minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut
aliquip ex ea commodo consequat.
6) CSS Text Color
<html>
<body>
OUTPUT:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex
ea commodo consequat.
<html>
<body>
</body>
</html> OUTPUT:
Hello World
Hello World
Hello World
8) CSS Color Values
In CSS, colors can also be specified using RGB values, HEX values, HSL values, RGBA values, and HSLA
values:
<html>
<body>
VM & VP | AASC
VM & VP AASC Web Technology 62
&
<h1 style="background-color:#ff6347;">#ff6347</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">hsl(9, 100%, 64%)</h1>
<p>In addition to the predefined color names, colors can be specified using RGB, HEX, HSL, or even
transparent colors using RGBA or HSLA color values.</p>
</body> </html>
OUTPUT:
#ff6347 hsl(9,
100%, 64%)
In addition to the predefined color names, colors can be specified using RGB, HEX, HSL, or even transparent colors
using RGBA or HSLA color values.
VM & VP | AASC