Sei sulla pagina 1di 55

Guru Nanak Dev Engineering College,

Ludhiana

IT Methodologies Lab

Submitted By :
Submitted To: Aakash Raj
RANJODH KAUR 1507884/156096
Assistant Professor Group-D2 IT A1
Semester:-3
IT Methodologies Lab 1507884

1 To familiarize with network devices like switch, hub, routers


and bridges.
SWITCH
In a telecommunications network, a switch is a device that channels incoming data from any of
multiple input ports to the specific output port that will take the data toward its intended des-
tination. In the traditional circuit-switched telephone network, one or more switches are used to
set up a dedicated though temporary connection or circuit for an exchange between two or more
parties. On an Ethernet local area network (LAN), a switch determines from the physical device
(Media Access Control or MAC) address in each incoming message frame which output port to
forward it to and out of. In a wide area packet-switched network such as the Internet, a switch
determines from the IP address in each packet which output port to use for the next part of its
trip to the intended destination.

In a telecommunications network, a switch is


a device that channels incoming data from any
of multiple input ports to the specific output
port that will take the data toward its intended
destination. In the traditional circuit-switched
telephone network, one or more switches are
used to set up a dedicated though temporary
connection or circuit for an exchange between
two or more parties. On an Ethernet local
area network (LAN), a switch determines from
the physical device (Media Access Control or
MAC) address in each incoming message frame
which output port to forward it to and out of.
In a wide area packet-switched network such as
the Internet, a switch determines from the IP address in each packet which output port to use for
the next part of its trip to the intended destination.
In the Open Systems Interconnection (OSI) communications model, a switch performs the Layer
2 or Data-link layer function. That is, it simply looks at each packet or data unit and determines
from a physical address (the MAC address) which device a data unit is intended for and switches
it out toward that device. However, in wide area networks such as the Internet, the destination
address requires a look-up in a routing table by a device known as a router. Some newer switches
also perform routing functions (Layer 3 or the Network layer functions in OSI) and are sometimes
called IP switches.
On larger networks, the trip from one switch point to another in the network is called a hop. The
time a switch takes to figure out where to forward a data unit is called its latency. The price paid
for having the flexibility that switches provide in a network is this latency. Switches are found at
the backbone and gateway levels of a network where one network connects with another and at
the subnetwork level where data is being forwarded close to its destination or origin. The former
are often known as core switches and the latter as desktop switches.
In the simplest networks, a switch is not required for messages that are sent and received within the
network. For example, a local area network may be organized in a token ring or bus arrangement
in which each possible destination inspects each message and reads any message with its address.
A networks paths can be used exclusively for a certain duration by two or more parties and then
switched for use to another set of parties. This type of switching is known as circuit-switching

1
IT Methodologies Lab 1507884

and is really a dedicated and continuously connected path for its duration. Today, an ordinary
voice phone call generally uses circuit-switching.
Most data today is sent, using digital signals, over networks that use packet-switching. Using
packet-switching, all network users can share the same paths at the same time and the particular
route a data unit travels can be varied as conditions change. In packet-switching, a message is
divided into packets, which are units of a certain number of bytes. The network addresses of the
sender and of the destination are added to the packet. Each network point looks at the packet
to see where to send it next. Packets in the same message may travel different routes and may
not arrive in the same order that they were sent. At the destination, the packets in a message are
collected and reassembled into the original message.

HUB
In general, a hub is the central part of a wheel where the spokes come together. The term is familiar
to frequent fliers who travel through airport hubs to make connecting flights from one point to
another. In data communications, a hub is a place of convergence where data arrives from one or
more directions and is forwarded out in one or more other directions. A hub usually includes a
switch of some kind. (And a product that is called a switch could usually be considered a hub
as well.) The distinction seems to be that the hub is the place where data comes together and
the switch is what determines how and where data is forwarded from the place where data comes
together. Regarded in its switching aspects, a hub can also include a router.
In describing network topologies, a hub topology consists of a backbone (main circuit) to which a
number of outgoing lines can be attached (dropped), each providing one or more connection port
for device to attach to. For Internet users not connected to a local area network, this is the general
topology used by your access provider. Other common network topologies are the bus network and
the ring network. (Either of these could possibly feed into a hub network, using a bridge.)
As a network product, a hub may include a group of modem cards for dial-in users, a gateway
card for connections to a local area network (for example, an Ethernet or a token ring), and a
connection to a line (the main line in this example).

2
IT Methodologies Lab 1507884

Routers
In packet-switched networks such as the Internet, a router is a device or, in some cases, software in
a computer, that determines the next network point to which a packet should be forwarded toward
its destination.
A router is a device that forwards data packets along networks. A router is connected to at least
two networks, commonly two LANs or WANs or a LAN and its ISPs network. Routers are located
at gateways, the places where two or more networks connect.
Routers use headers and forwarding tables to determine the best path for forwarding the packets,
and they use protocols such as ICMP to communicate with each other and configure the best route
between any two hosts.

The router is connected to at least two net-


works and decides which way to send each in-
formation packet based on its current under-
standing of the state of the networks it is con-
nected to. A router is located at any gate-
way (where one network meets another), in-
cluding each point-of-presence on the Internet.
A router is often included as part of a network
switch.
A router may create or maintain a table of the
available routes and their conditions and use
this information along with distance and cost
algorithms to determine the best route for a
given packet. Typically, a packet may travel through a number of network points with routers
before arriving at its destination. Routing is a function associated with the Network layer (layer 3)
in the standard model of network programming, the Open Systems Interconnection (OSI) model.
A layer-3 switch is a switch that can perform routing functions.
An edge router is a router that interfaces with an asynchronous transfer mode (ATM) network. A
brouter is a network bridge combined with a router.
For home and business computer users who have high-speed Internet connections such as cable,
satellite, or DSL, a router can act as a hardware firewall. This is true even if the home or business
has only one computer. Many engineers believe that the use of a router provides better protec-
tion against hacking than a software firewall, because no computer Internet Protocol address are
directly exposed to the Internet. This makes port scans (a technique for exploring weaknesses)
essentially impossible. In addition, a router does not consume computer resources as a software
firewall does. Commercially manufactured routers are easy to install, reasonably priced, and avail-
able for hard-wired or wireless networks.

3
IT Methodologies Lab 1507884

Bridges
In telecommunication networks, a bridge is a product that connects a local area network (LAN)
to another local area network that uses the same protocol (for example, Ethernet or token ring).
You can envision a bridge as being a device that decides whether a message from you to someone
else is going to the local area network in your building or to someone on the local area network in
the building across the street. A bridge examines each message on a LAN, passing those known
to be within the same LAN, and forwarding those known to be on the other interconnected LAN
(or LANs).

In bridging networks, computer or node ad-


dresses have no specific relationship to location.
For this reason, messages are sent out to every
address on the network and accepted only by
the intended destination node. Bridges learn
which addresses are on which network and de-
velop a learning table so that subsequent mes-
sages can be forwarded to the right network.
Bridging networks are generally always inter-
connected local area networks since broadcast-
ing every message to all possible destinations
would flood a larger network with unnecessary
traffic. For this reason, router networks such
as the Internet use a scheme that assigns ad-
dresses to nodes so that a message or packet
can be forwarded only in one general direction
rather than forwarded in all directions.
A bridge works at the data-link (physical net-
work) level of a network, copying a data frame
from one network to the next network along the communications path.
Bridge devices work at the data link layer of the Open System Interconnect (OSI) model, connecting
two different networks together and providing communication between them. Bridges are similar
to repeaters and hubs in that they broadcast data to every node. However, bridges maintain the
media access control (MAC) address table as soon as they discover new segments, so subsequent
transmissions are sent to only to the desired recipient.
A network bridge device is primarily used in local area networks because they can potentially flood
and clog a large network thanks to their ability to broadcast data to all the nodes if they don?t
know the destination nodes MAC address.

4
IT Methodologies Lab 1507884

2 To configure the IP address for a computer connected to


LAN.
Configure Your PC to a Local Area Network Step 1

First and foremost, attach the RJ-45 connector to the Ethernet network port on
your PC.

5
IT Methodologies Lab 1507884

Right click on ?My Network Places? icons located on the desktop and in the popup
menu click on properties. You can also find it through the My Computer window.
Alternatively, click ?Start? from the taskbar and right click on ?My Network Places?
option from the popup menu. In the menu that appears select ?Properties? In the

new Window that appears, under the LAN or High-Speed internet, right on ?Local
Area Connection? and select properties in the popup menu that appears.

6
IT Methodologies Lab 1507884

In the local area connection dialog box that appears under the connection box, scroll
down and select ?Internet Protocol (TCP/IP) and click on ?Properties.

Step 5 To obtain the settings automatically, select ?Obtain an IP Address Automatically?. How-
ever, to use this option, you will need to have a DHCP server that will function in allocating and
managing IP address to ensure that there are no conflicts. To configure your PC to the network
manually, follow the procedures listed below:
Click the option ?Use the following IP Address?. Enter the IP address to use. It is important that
you consult your network administrator on the IP to use so as to avoid conflicts occurring in the
network, i.e. a situation where two PCs have similar IP addresses. Thereafter, enter the Subnet
Mask and Default gateway. The subnet mask is used to identify the network level you are in while
the default gateway identifies the router connection

7
IT Methodologies Lab 1507884

Thereafter, enter the Preferred DNS server and Alternate DNS server address

Click ?OK? to accept the changes or ?cancel? to exit the setup.

Check the option ?Show icon in notification area when connected? and click ?OK?. This will
enable you to know if the local area connection is connected or disconnected.

8
IT Methodologies Lab 1507884

Configure network parameters


If you want to browse a little more anonymously, or your business requires you to connect to their
server, you may be considering connecting to the internet through a proxy. In order to connect to
your chosen proxy server, you will need to adjust some settings in your Firefox browser. Read this
guide to find out how.

2 Open the Advanced category. It is on the right end of the category list. Click on the Network
tab.

3 Click the Settings button. This will open the Connection Settings window.

4 Choose ?Manual proxy configuration?. This will allow you to enter information in the fields
below

9
IT Methodologies Lab 1507884

Enter your proxy information. Enter the proxy server that you are connecting to in the ?HTTP
Proxy? field. If you need to enter a specific port, enter it into the ?Port? field.
Then press ok button

10
IT Methodologies Lab 1507884

3 To get familiarize with various troubleshooting utilities


like ping, ipconfig, arp, traceroute, mtr, tcdump, win-
dump, nslookup and netstat.
Troubleshooting
Do you know what to do if your screen goes blank? What if you cant seem to close an application,
or cant hear any sound from your speakers? Whenever you have a problem with your computer,
dont panic! There are many basic troubleshooting techniques you can use to fix issues like this.
In this lesson, well show you some simple things to try when troubleshooting, as well as how to
solve common problems you may encounter.

Ping The ping command sends ICMP echo request packets to a destination. For example, you
could run ping google.com or ping 173.194.33.174 to ping a domain name or IP address.
These packets ask the remote destination to reply. If the remote destination is configured to reply,
it will respond with packets of its own. You?ll be able to see how long the round-trip time is
between your computer and the destination. You?ll see a ?request timed out? message if packet
loss is occurring, and you?ll see an error message if your computer can?t communicate with the
remote host at all.
This tool can help you troubleshoot Internet connection problems, but bear in mind that many
servers and devices are configured not to reply to pings.

11
IT Methodologies Lab 1507884

Ipconfig
The ipconfig command is used on Windows, while the ifconfig command is used on Linux, Mac OS
X, and other Unix-like operating systems. These commands allow you to configure your network
interfaces and view information about them.

For example, you can use the ipconfig /all command on Windows to view all your configured
network interfaces, their IP addresses, DNS servers, and other information. Or, you can use the
ipconfig /flushdns command to flush your DNS cache, forcing Windows to get new addresses from
its DNS servers every time you contact a new hostname. Other commands can force your computer
to release its IP address and get a new one from its DHCP server. This utility can quickly display
your computer?s IP address or help you troubleshoot problems.

ARP
The ARP utility helps diagnose problems associated with the Address Resolution Protocol (ARP).
TCP/IP hosts use ARP to determine the physical (MAC) address that corresponds with a specific
IP address. Type arp with the ? a option to display IP addresses that have been resolved to MAC
addresses recently.

Traceroute
The traceroute, tracert, or tracepath command is similar to ping, but provides information about
the path a packet takes. traceroute sends packets to a destination, asking each Internet router
along the way to reply when it passes on the packet. This will show you the path packets take

12
IT Methodologies Lab 1507884

when you send them between your location and a destination.


This tool can help troubleshoot connection problems. For example, if you can?t communicate with
a server, running traceroute may show you where the problem is occurring between your computer
and the remote host.

13
IT Methodologies Lab 1507884

MTR
MTR is a powerful network diagnostic tool that enables administrators to diagnose and isolate
networking errors and provide helpful reports of network status to upstream providers. MTR
represents an evolution of the traceroute command by providing a greater data sample, as if aug-
menting traceroute with ping output. This document provides an in depth overview of MTR, the
data it generates, and how to properly interpret and draw conclusions based on the data provided
by it.
For a basic overview of network diagnostic techniques consider our introduction to network diag-
nostics. If you suspect that you?re having some other issue with your system, you may consider
our overview of general system diagnostics. As a matter of course, it is assumed that all Linode
deployments will have completed our getting started guide prior to beginning with this document.

Tcpdump
The tcpdump program was developed at the Lawrence Berkeley Laboratory at the University of
California, Berkeley, by Van Jacobson, Craig Leres, and Steven McCanne. It was originally devel-
oped to analyze TCP/IP performance problems. A number of features have been added over time
although some options may not be available with every implementation. The program has been
ported to a wide variety of systems and comes preinstalled on many systems.
For a variety of reasons, tcpdump is an ideal tool to begin with. It is freely available, runs on many
Unix platforms, and has even been ported to Microsoft Windows. Features of its syntax and its file
format have been used or supported by a large number of subsequent programs. In particular, its
capture software, libpcap, is frequently used by other capture programs. Even when proprietary
programs with additional features exist, the universality of tcpdump makes it a compelling choice.
If you work with a wide variety of platforms, being able to use the same program on all or most
of the platforms can easily outweigh small advantages proprietary programs might have. This is
particularly true if you use the programs on an irregular basis or dont otherwise have time to fully
master them. It is better to know a single program well than several programs superficially. In
such situations, special features of other programs will likely go unused.
Since tcpdump is text based, it is easy to run remotely using a Telnet connection. Its biggest
disadvantage is a lack of analysis, but you can easily capture traffic, move it to your local machine,
and analyze it with a tool like ethereal. Typically, I use tcpdump in text-only environments or
on remote computers. I use ethereal in a Microsoft Windows or X Window environment and to
analyze tcpdump files.

windump
Windows ports of the most powerful and widely used Unix command-line tools actually are fairly
common. Ive used various Windows versions of the search tool grep, for instance. Among the most
useful is tcpdump, a tool for capturing and reporting packet headers in network traffic for further
analysis. The folks at Cace Technologies have compiled a Windows port of the program named
WinDump, with just about the entire feature set of its Unix-based brethren. The full source code
for the program is also included, in the event that you want to compile a custom version.
Dumping network traffic has many possible applications. Ive used it to determine if malware was
installed in a given machine by seeing if packets were being broadcast from the computer when
there should not have been anything else running (it could also divine their header information
and destination). Aside from logging all available traffic, the program can capture and report only
the packets that have certain matching information in their headers useful if you already know
what youre looking for and just want to cut to the chase.
installation and basic use
WinDump comes in two parts. The first is a set of network capture drivers called WinPcap, which

14
IT Methodologies Lab 1507884

WinDump uses to obtain packet-level access to network interfaces in the computer. The second
part is the program itself, windump, which is invoked from the command line after youve installed
the WinPcap library.
The first option youll want to use when you run windump is -D, which lists all available network
interfaces in the current system. By default, the program listens on the first available interface,
but in Windows, it is typically the software dial-up adapter, not a physical network adapter. The
results from -D usually look something like this

Nslookup
If you are running a DNS server on your Windows NT or Windows 2000 network, you know that
various problems can arise and cause the system to go haywire. When that happens, you dig into
your arsenal of troubleshooting tools and go to work. If you are running Windows NT, chances
are you head to the DNS Manager, since it is the primary tool for managing Windows NT DNS
name servers. If you are running Windows 2000, you typically head to the DNS Console, since it
is the primary tool for administering Windows 2000 DNS name servers.
However, regardless of which operating system you are running, there is another DNS troubleshoot-
ing tool that is often overlooked, yet incredibly handy?the Nslookup utility. This clever little
service, which can run from the client (either Windows NT Workstation or Windows 2000 Profes-
sional) in addition to the server platform, is a DOS-based program designed to display information
from a DNS name server that can help you set your sights on DNS-related problems.
In this Daily Drill Down, I will introduce you to the Nslookup utility and explain how the utility
works. I will also pass on some basic DNS name server troubleshooting techniques that you can
perform with the Nslookup utility.
Like many of the other TCP/IP utilities that come with Windows NT/2000, you run the Nslookup
utility from a command prompt. Unlike the other TCP/IP utilities that come with Windows
NT/2000, the Nslookup utility has two modes of operation: interactive and noninteractive. The
mode you will use depends on how much information you want the Nslookup utility to return.

Netstat
netstat stands for network statistics. This command displays incoming and outgoing network con-
nections as well as other network information. It?s available on Windows, Mac, and Linux ? each
version has its own command-line options you can tweak to see different types of information.
netstat stands for network statistics. This command displays incoming and outgoing network con-
nections as well as other network information. It?s available on Windows, Mac, and Linux ? each
version has its own command-line options you can tweak to see different types of information.

15
IT Methodologies Lab 1507884

4 To setup IIS and Apache Web Server on computer sys-


tem.
What is a Web Server?
A web server is software that listens for requests and returns data (usually a file). When you
type ?www.mysite.com?, the request is forwarded to a machine running web server software which
returns a file back to your browser, e.g. the contents of index.html. The browser might then make
further requests based on the HTML content, e.g. CSS, JavaScript, and graphic files.
Since the web server sits between your browser and the requested file, it can perform processing
that is not possible by opening an HTML file directly. For example, it can parse PHP code which
connects to a database and returns data.
You can use your host?s web server for testing, but uploading will become tiresome and changes
could go live before they had been fully tested. What you need is a local web server installation.
Why Apache?
In general, I would recommend using the web server software that your web host uses. Unless you
are creating ASP.NET applications on Microsoft IIS, your host is likely to use Apache: the most
widespread and fully-featured web server available. It is open-source project so it does not cost
anything to download or install.
The following instructions describe how to install Apache on Windows. Mac OSX comes with
Apache and PHP, although you might need to enable them. Most Linux users will have Apache
pre-installed or available in the base repositories.
All-in-One packages
There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and
other applications in a single installation file, e.g. XAMPP (including a Mac version), WampServer
and Web.Developer. There is nothing wrong with using these packages, although manually in-
stalling Apache will help you learn more about the system and its configuration options.
The Apache Installation Wizard
An excellent official .msi installation wizard is available from the Apache download page. This
option is certainly recommended for novice users or perhaps those installing Apache for the first

16
IT Methodologies Lab 1507884

time.
Manual Installation
Manual installation offers several benefits:
backing up, reinstalling, or moving the web server can be achieved in seconds (see 8 Tips for Sur-
viving PC Failure)
you have more control over how and when Apache starts
you can install Apache anywhere, such as a portable USB drive (useful for client demonstrations).
textbfStep 1: configure IIS, Skype and other software (optional)
If you have a Professional or Server version of Windows, you may already have IIS installed. If
you would prefer Apache, either remove IIS as a Windows component or disable its services.
Apache listens for requests on TCP/IP port 80. The default installation of Skype also listens
on this port and will cause conflicts. To switch it off, start Skype and choose Tools Options
Advanced Connection. Ensure you untick ?Use port 80 and 443 as alternatives for incoming
connections?.
Step 2: download the files
We are going to use the unofficial Windows binary from Apache Lounge. This version has per-
formance and stability improvements over the official Apache distribution, although I am yet to
notice a significant difference. However, it is provided as a manually installable ZIP file from
www.apachelounge.com/download/
You should also download and install the Windows C++ runtime from Microsoft.com. You may
have this installed already, but there is no harm installing it again.
As always, remember to virus scan all downloads.
Step 2: extract the files
We will install Apache in C:Apache2, so extract the ZIP file to the root of the C: drive.
Apache can be installed anywhere on your system, but you will need to change the configuration
file paths accordingly?
Step 3: configure Apache
Apache is configured with the text file confhttpd.conf contained in the Apache folder. Open it with
your favourite text editor.
Note that all file path settings use a ?/? forward-slash rather than the Windows backslash. If you
installed Apache anywhere other than C:Apache2, now is a good time to search and replace all
references to ?c:/Apache2?.
There are several lines you should change for your production environment:
Line 46, listen to all requests on port 80:
Listen 80
Line 116, enable mod-rewrite by removing the (optional, but useful):
LoadModule rewrite module modules/mod rewrite.so
Line 172, specify the server domain name:
ServerName localhost:80
Line 224, allow .htaccess overrides:
AllowOverride All
Step 4: change the web page root (optional)
By default, Apache return files found in its htdocs folder. I would recommend using a folder on
an another drive or partition to make backups and re-installation easier. For the purposes of this
example, we will create a folder called D:WebPages and change httpd.conf accordingly:
Line 179, set the root:
DocumentRoot D:/WebPages
and line 204:
Directory D:/WebPages

17
IT Methodologies Lab 1507884

Step 5: test your installation


Your Apache configuration can now be tested. Open a command box (Start Run cmd) and
enter:
cd Apache2bin
httpd -t
Correct any httpd.conf configuration errors and retest until none appear.
6: install Apache as a Windows service
The easiest way to start Apache is to add it as a Windows service. From a command prompt,
enter:
cd Apache2bin
httpd -k install
Open the Control Panel, Administrative Tools, then Services and double-click Apache2.2. Set the
Startup type to ?Automatic? to ensure Apache starts every time you boot your PC.
Alternatively, set the Startup type to ?Manual? and launch Apache whenever you choose using
the command ?net start Apache2.2?.
Step 7: test the web server
Create a file named index.html in Apache?s web page root (either htdocs or D:WebPages) and add
a little HTML code:
html
headtitletesting Apache/title/head
bodypApache is working!/p/body
/html
Ensure Apache has started successfully, open a web browser and enter the address http://localhost/.
If all goes well, your test page should appear.
In general, most problems will be caused by an incorrect setting in the httpd.conf configuration
file. Refer to the Apache documentation if you require further information.

18
IT Methodologies Lab 1507884

5 To create a simple html file to demonstrate the use of


different tags.
Input
<html>
<head>
<title>Practical 5</title>
</head>
<body>
<body bgcolor="#E6E6FA">
<h1>Practical:-5</h1>
<p>To create a simple html file to demonstrate the use of different tags</p>
<P align=right><a href="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%206.html">Aakash Ra
<hr>
<ol><li>The best surfing games</li>
<ul type="disc">
<li>vicecity</li>
</ul>
<ul type="circle">
<li>surfertoday</li>
</ul>
<ul type="square">
<li>stabmag</li>
</ul><br>
<li>
The best surfing sites
</li>
<ol><li>YouTube</li>
<li>facebook</li>
<li>google</li>
<li>amazon</li>
<li>yahoo</li>
</ol>
</ol>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

19
IT Methodologies Lab 1507884

Output

Shot 1.png Shot 1.png

Figure 1: Practical:-5

20
IT Methodologies Lab 1507884

6 To create an html file to link to different html page which


contains images, tables, and also link within a page.
Input

<htmal>
<head>
<title>Practical 6</title>
</head>
<body>
<body bgcolor="#F5F6A2">
<a href="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%208.html">
<p align=center><img src="Aakash Raj.webp" alt="Aakash Raj" width="300" height="300" border="1"></
<h1 align=center>Aakash Raj</h1>
<legend>Qualification information:</legend>
<table border="1" width="100%">
<tr>
<th colspan="2">Class</th>
<th>College/school</th>
<th>Marks%</th>
<th>Passed year</th>
</tr>
<tr>
<td colspan="2">10th</td>
<td>F.N.S. Academy</td>
<td>76%</td>
<td>2013</td>
</tr>
<tr>
<td colspan="2">12th</td>
<td>S.G.G.S College</td>
<td>78%</td>
<td>2015</td>
</tr>
<th rowspan="2" >B.Tech:</th>
<td>1st semester</td>
<td>GNDEC,Ludhiana</td>
<td>78%</td>
<td> 2015 Dec</td>
</tr>
<tr>
<td>2nd semester</td>
<td>GNDEC,ludhiana</td>
<td>72%</td>
<td>2016 May</td>
</tr>
</table>

21
IT Methodologies Lab 1507884

</body>
</htmal>
output

Shot 2.png Shot 2.png

Figure 2: Practical:-6

22
IT Methodologies Lab 1507884

7 To create an html page with different types of frames such


as floating frame, navigation frame and mixed frame.
Input

<html>
<head>
<title>Practical 7
</title>
</head>
<frameset rows="50%,50%">
<frame src="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%206.html" name="top">
<frameset cols="50%,50%">
<frame src="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%205.html" name="left">
<frame src="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%208.html" name="right">
</frameset>
</html>
Output

Shot 3.png Shot 3.png

Figure 3: Practical:-7

23
IT Methodologies Lab 1507884

8 To create a registration form by using various form ele-


ments like input box, textarea, radio buttons etc.
Input

<html>
<head>
<title>Practical 8
</title>
</head>
<body>
<body bgcolor="#F7E1B4">
<form >
<fieldset>
<legend>Personal information:</legend>
<h1 align=center>
First Name:<input type="text" name="First Name"><br>
Last Name:<input type="text" name="laste Name"><br>
Email Address: <input type="Email" name="email address"><br>
Gender:<input type="radio" name="gender">Male<br>
<input type="radio" name="gender">Female<br>
Hobbies:
<select >
<option value="Reading">Reading</option>
<option value="Watching TV">Watching TV</option>
<option value="Computer">Computer</option>
<option value="Walking">Walking</option>
<option value="Listening to Music">Listening to Music</option>
<option value="Shopping">Shopping</option>
<option value="Traveling">Traveling</option>
<option value="Sleeping">Sleeping</option>
<option value="Swimming">Swimming</option>
<option value="Writing">Writing</option>
<option value="Bowling">Bowling</option>
<option value="Dancing">Dancing</option>
</select><br>
Comment: <textarea name="comment" rows="5" cols="40"></textarea><br>
Password:<input type="password" name="password"><br>
<input type="submit" value="Submit">
</fieldset>
</form>
</body>
</html>

24
IT Methodologies Lab 1507884

Output

Shot 4.png Shot 4.png

Figure 4: Practical:-8

25
IT Methodologies Lab 1507884

9 To write an html file implementing the concept inline,


external and internal style sheets.
Input
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
ol{
color: #008000;
}
</style>
</head>
<body>
<h1>Practical:-9</h1>
<p>To create a simple html file to demonstrate the use of different tags</p>
<P align=right><a href="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%206.html">Aakash Ra
<hr>
<ol><li>The best surfing games</li>
<ul type="disc">
<li>vicecity</li>
</ul>
<ul type="circle">
<li>surfertoday</li>
</ul>
<ul type="square">
<li>stabmag</li>
</ul><br>
<li>
The best surfing sites
</li>
<ol><li>YouTube</li>
<li>facebook</li>
<li>google</li>
<li>amazon</li>
<li>yahoo</li>
</ol>
</ol>
<hr>
<h2 style="color:blue;margin-left:30px;"><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>

26
IT Methodologies Lab 1507884

<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>


</body>
</body>
</html>
.css File
body
{
background-color:#3A73A3;
}
p4
{
font-style:serif;
font-size:40px;
text-align: justify;
}
span
{
font-style:sans-serif;
text-decoration:underline;
font-size:35px;
text-align: center;
}
Output

Shot 5.png Shot 5.png

Figure 5: Practical:-9

27
IT Methodologies Lab 1507884

10 To create an html file to implement the concept of mar-


gin, padding using cascading style sheets.
Input
<html>
<head>
<style>
div {
border: 12px solid green;
outline-style: double;
outline-color: green;
outline-width: 3px;
margin: 10px 100px 100px 140px;
background-color: #F2F7B4;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
</style>
</head>
<body>
<div><form >
<fieldset>
<legend>Personal information:</legend>
<h1 align=center>
First Name:<input type="text" name="First Name"><br>
Last Name:<input type="text" name="laste Name"><br>
Email Address: <input type="Email" name="email address"><br>
Gender:<input type="radio" name="gender">Male<br>
<input type="radio" name="gender">Female<br>
Hobbies:
<select >
<option value="Reading">Reading</option>
<option value="Watching TV">Watching TV</option>
<option value="Computer">Computer</option>
<option value="Walking">Walking</option>
<option value="Listening to Music">Listening to Music</option>
<option value="Shopping">Shopping</option>
<option value="Traveling">Traveling</option>
<option value="Sleeping">Sleeping</option>
<option value="Swimming">Swimming</option>
<option value="Writing">Writing</option>
<option value="Bowling">Bowling</option>
<option value="Dancing">Dancing</option>
</select><br>
Comment: <textarea name="comment" rows="5" cols="40"></textarea><br>

28
IT Methodologies Lab 1507884

Password:<input type="password" name="password"><br>


<input type="submit" value="Submit">
</fieldset>
</form>
</div>
</body>
</html>
output

Shot 6.png Shot 6.png

Figure 6: Practical:-10

29
IT Methodologies Lab 1507884

11 To create an html file to implement the styles related to


text, fonts, links, lists using cascading style sheets.
Input
<html>
<head>
<style>
body {
color: blue;
background-color: #ccffff;
}

h1 {
color: green;
text-decoration: underline;
}
h2 {
text-align: right;
text-transform: capitalize;
}
h3 {
text-align: right;
}
div {
border: 1px solid black;
padding: 10px;
width: 100%px;
height: 250px;
text-align: justify;
}
p1{
font-style: italic;
font-size: 20px;
font-weight: bold;
}
a:link {
background-color: yellow;
}

a:visited {
background-color: cyan;
}

a:hover {
background-color: lightgreen;
}

30
IT Methodologies Lab 1507884

a:active {
background-color: hotpink;
}
ul.a {
list-style-type: circle;
}

ul.b {
list-style-type: square;
}

ol.c {
list-style-type: disc;
}

ol.d {
list-style-type: lower-alpha;
}
</style>
<body>
<h1>Practical:-11</h1>
<p1>To create an html file to implement the styles related to text, fonts, links, lists using casc
sheets.</p1>
<P align=right><a href="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%206.html">Aakash R
<div>
<ol><li>The best surfing games</li>
<ul class="c">
<li>vicecity</li>
</ul>
<ul class="a">
<li>surfertoday</li>
</ul>
<ul class="b">
<li>stabmag</li>
</ul><br>
<li>
The best surfing sites
</li>
<ol class="d">
<li>YouTube</li>
<li>facebook</li>
<li>google</li>
<li>amazon</li>
<li>yahoo</li>
</ol>
</ol>
</div>
<h2>
guru nanak dev engineering college, ludhiana</h2>

31
IT Methodologies Lab 1507884

<h3><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></h3>
</body>
</body>
</html>
Output

Shot 7.png Shot 7.png

Figure 7: Practical:-11

32
IT Methodologies Lab 1507884

12 To create an html file to implement the concept of css


styles on html tags like table, anchor, list etc.
Input
<htmal>
<head>
<style>
table, th, td {
border: 1px solid black;
}
table {
border-collapse: collapse;
width: 100%;
}

th {
height: 30px;
}
td {
height: 30px;
}
th, td {
padding: 15px;
}
tr:nth-child(even){background-color:#F2F7B4}

</style></head>
<body>
<body bgcolor="#F5F6A2">
<a href="file:///Users/aakashraj/Desktop/im%20lab%20html/Aakash%208.html">
<p align=center><img src="Aakash Raj.webp" alt="Aakash Raj" width="300" height="300" border="1"></
<h1 align=center>Aakash Raj</h1>
<legend>Qualification information:</legend>
<table >
<tr>
<th colspan="2">Class</th>
<th>College/school</th>
<th>Marks%</th>
<th>Passed year</th>
</tr>
<tr>
<td colspan="2">10th</td>
<td>F.N.S. Academy</td>
<td>76%</td>
<td>2013</td>
</tr>
<tr>

33
IT Methodologies Lab 1507884

<td colspan="2">12th</td>
<td>S.G.G.S College</td>
<td>78%</td>
<td>2015</td>
</tr>
<th rowspan="2" >B.Tech:</th>
<td>1st semester</td>
<td>GNDEC,Ludhiana</td>
<td>78%</td>
<td> 2015 Dec</td>
</tr>
<tr>
<td>2nd semester</td>
<td>GNDEC,ludhiana</td>
<td>72%</td>
<td>2016 May</td>
</tr>
</table>
</body>
</htmal>
Output

Shot 8.png Shot 8.png

Figure 8: Practical:-12

34
IT Methodologies Lab 1507884

13 To create an html file to implement the concept of doc-


ument object model using javascript.
Input
<html>
<head>
<title>Practical 13</title>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</head>
<body>
<body bgcolor="#FCFCDE">
<h1>Practical:-13</h1>
<p>To create an html file to implement the concept of document object model using javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<h1>JavaScript in Head</h1>
<p id="demo">A Paragraph.</p>
<button type="button" onclick="myFunction()">Try it</button><hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</html>

35
IT Methodologies Lab 1507884

Output

Shot 9.png Shot 9.png

Figure 9: Practical:-13

36
IT Methodologies Lab 1507884

14 To create an html file and to display the various arith-


metic operations on variables using javascript.
Input
<html>
<head>
<title>Practical 14</title>
</head>
<body>
<body bgcolor="#F6DEFC">
<h1>Practical:-14</h1>
<p>To create an html file and to display the various arithmetic operations on variables using java
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<b>JavaScript Arithmetic Operators</b>
<center>
<script type="text/javascript">
var a = 15;
var b = 25;
var c = 56;
var linebreak = "<br />";
document.write("a = " +a);
document.write(linebreak);
document.write("b = " +b);
document.write(linebreak);
document.write("a + b = ");
result = a + b;
document.write(result);
document.write(linebreak);
document.write("a - b = ");
result = a - b;
document.write(result);
document.write(linebreak);
document.write("a / b = ");
result = a / b;
document.write(result);
document.write(linebreak);
document.write("a % b = ");
result = a % b;
document.write(result);
document.write(linebreak);
document.write("a + b + c = ");
result = a + b + c;
document.write(result);
document.write(linebreak);
a = a++;
document.write("a++ = ");

37
IT Methodologies Lab 1507884

result = a++;
document.write(result);
document.write(linebreak);
b = b--;
document.write("b-- = ");
result = b--;
document.write(result);
document.write(linebreak);
</script>
</center>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</html>
Output

Shot 10.png Shot 10.png

Figure 10: Practical:-14

38
IT Methodologies Lab 1507884

15 To create an html file to implement alert box, confirm


box, dialog box using javascript.
Input
<html>
<head>
<title>Practical 15</title>
</head>
<body>
<body bgcolor="#FCFADE">
<h1>Practical:-15</h1>
<p>To create an html file to implement alert box, confirm box, dialog box using javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<center>
<p>Click the button!!</p>
<button onclick="alert_box()">This is an Alert Box</button>
<p>Click the button!!</p>
<button onclick="dialog_box()">This is an Dialog Box</button>
<p id="demodialog"></p>
<p>Click the button!!</p>
<button onclick="confirm_box()">This is an Confirm Box</button>
<p id="democonfirm"></p>
<script>
function alert_box()
{
alert("ALERT!");
}

function dialog_box()
{
var person = prompt("Please enter your name", "Aakash Raj");
if (person != null)
{
document.getElementById("demodialog").innerHTML ="Hello "+person+"! How are you today?";
}
}

function confirm_box()
{
var x;
if(confirm("Press a button!")==true)
{
x="Pressed OK!";
}
else
{

39
IT Methodologies Lab 1507884

x="Pressed Cancel!";
}
document.getElementById("democonfirm").innerHTML = x;
}
</script>
</center>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>
Output

Shot 12.png Shot 12.png

Figure 11: Practical:-15

40
IT Methodologies Lab 1507884

16 To create an html file to implement concept of functions


and arrays using javascript.
Input
<html>
<head>
<title>Practical 16</title>
</head>
<body>
<body bgcolor="#FAF3EC">
<h1>Practical:-16</h1>
<p>To create an html file to implement concept of functions and arrays using javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<center>
<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
"The temperature is " + toCelsius(77) + " Celsius";

function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
</script>
<button onclick="get_first()">Click to Get First Element</button>
<p id="demo1"></p>
<script>
function get_first()
{
var cars=[
"Volvo",
"BMW"
];
document.getElementById("demo1").innerHTML=cars[1];
}
</script>
</center>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

41
IT Methodologies Lab 1507884

Output

Shot 14.png Shot 14.png

Figure 12: Practical:-16

42
IT Methodologies Lab 1507884

17 To create a user defined function in javascript to get


array of values and sort them in ascending order.
Input
<html>
<head>
<title>Practical 17</title>
</head>
<body>
<body bgcolor="#ECF8FA">
<h1>Practical:-17</h1>
<p>To create a user defined function in javascript to get array of values and sort them in ascendi
order.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<center>
<p>The sort method sorts an array alphabetically.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.sort();
document.getElementById("demo").innerHTML = fruits;
}
</script>
</center>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

43
IT Methodologies Lab 1507884

Output

Shot 15.png Shot 15.png

Figure 13: Practical:-17

44
IT Methodologies Lab 1507884

18 To demonstrate the use of control statements and loops


in javascript.
Input
<html>
<head>
<title>Practical 18</title>
</head>
<body>
<body bgcolor="#EDFBDD">
<h1>Practical:-18</h1>
<p>To demonstrate the use of control statements and loops in javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<script>
var b,z,c=0;
var a=prompt("Enter a number");
z=a;
while(z>0)
{
b=z%10;
c=c+(b*b*b);
z=parseInt(z/10);
}
if(a==c)
alert("given no is amstrong number");
else
alert("given no is not an amstrong number");
</script>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

45
IT Methodologies Lab 1507884

Output

Shot 16.png Shot 16.png

Figure 14: Practical:-18

46
IT Methodologies Lab 1507884

19 To demonstrate string and math object?s predefined meth-


ods using javascript.
Input
<html>
<head>
<title>Practical 19</title>
</head>
<body>
<body bgcolor="#DDF8FB">
<h1>Practical:-19</h1>
<p>To demonstrate string and math object?s predefined methods using javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<p id="p1">Please locate where locate occurs!.</p>
<button onclick="stringindex()">Try it</button>
<p id="pos"></p>
<p id="lastpos"></p>
<script>
function stringindex()
{
var str = document.getElementById("p1").innerHTML;
var pos = str.indexOf("locate");
var last_pos = str.lastIndexOf("locate");
document.getElementById("pos").innerHTML = "Word locate occurs at "+pos;
document.getElementById("lastpos").innerHTML = "Word locate occurs last at "+last_pos;
}
</script>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

47
IT Methodologies Lab 1507884

Output

Shot 18.png Shot 18.png

Figure 15: Practical:-19

48
IT Methodologies Lab 1507884

20 To demonstrate array objects and date object?s prede-


fined methods using javascript.
Input
<html>
<head>
<title>Practical 20</title>
</head>
<body>
<body bgcolor="#DDFBE4">
<h1>Practical:-20</h1>
<p>To demonstrate array objects and date objects predefined methods using javascript.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<p>The toString() method returns an array as a comma separated string.</p>
<p id="demo"></p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.toString();
</script>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

49
IT Methodologies Lab 1507884

Output

Shot 19.png Shot 19.png

Figure 16: Practical:-20

50
IT Methodologies Lab 1507884

21 To implement the concept of event handling and validat-


ing registration form.
Input
<html>
<head>
<script>
function validateForm() {
var x = document.forms["myForm"]["fname"].value; if (x == null || x == "") {
alert("Name must be filled out");
return false; } }
</script>
<title>Practical 21</title>
</head>
<body>
<body bgcolor="#ECF3FA">
<h1>Practical:-21</h1>
<p>To implement the concept of event handling and validating registration form.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<center>
<button onclick="getElementById(demo).innerHTML=Date()">The time is?</button>
<p id="demo"></p>
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post"> Name: <
<input type="submit" value="Submit"> </form>
</center>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>

51
IT Methodologies Lab 1507884

Output

Shot 20.png Shot 20.png

Figure 17: Practical:-21

52
IT Methodologies Lab 1507884

22 To demonstrate the use of expression, array, math, string,


date functions.
Input
<html>
<head>
<title>Practical 22</title>
</head>
<body>
<body bgcolor="#DDE0FB">
<h1>Practical:-22</h1>
<p>To demonstrate the use of expression, array, math, string, date functions.</p>
<P align=right><a href="http://avirusraj.blogspot.in/">Aakash Raj</a></P>
<hr>
<p>Use of Expressions</p>
<p id="demo1"></p>
<p>Use of Array Length Function</p>
<p id="demo2"></p>
<p id="demo3"></p>
<p>Sorted Array is</p>
<p id="demo4"></p>
<p>Sorted Array in reverse order</p>
<p id="demo5"></p>
<p>Following is String</p>
<p id="demo6"></p>
<p id="demo7"></p>
<p id="demo8"></p>
<p>The getDay() method returns the weekday as a number:</p>
<p id="demo9"></p>
<p>Date.parse(string) returns milliseconds.</p>
<p>You can use the return value to convert the string to a date object:</p>
<p id="demo10"></p>
<script>
var x=10;
var y=20;
var z= x+y*x/y;
var d = new Date();
var str="Guru Nanak Dev Engineering College Ludhiana";
var pos = str.indexOf("Engineering");
var arr1= ["IT", "CSE", "Prod", "ME", "ECE"];
document.getElementById("demo1").innerHTML = "<b>Output of z= x+y*x/y is </b>"+z;
document.getElementById("demo2").innerHTML = "<b>Array is </b>"+arr1;
document.getElementById("demo3").innerHTML = "<b>Length of Array is </b>"+arr1.length;
document.getElementById("demo4").innerHTML = "<b>Sorted Array is </b>"+arr1.sort();
document.getElementById("demo5").innerHTML = "<b>Sorted Array in reverse order </b>"+arr1.reve
document.getElementById("demo6").innerHTML = str;
document.getElementById("demo7").innerHTML = "<b>Location of word Engineering is at </b>"+pos;

53
IT Methodologies Lab 1507884

document.getElementById("demo8").innerHTML ="<b>String in Upper Case using toUpperCase() </b><br/>


document.getElementById("demo9").innerHTML = d.getDay();
var msec = Date.parse("March 21, 2012");
var d = new Date(msec);
document.getElementById("demo10").innerHTML = d;
</script>
<hr>
<h2><P align=right>
Guru Nanak Dev Engineering College, Ludhiana</P></h2>
<h3><P align=right><a href="http://gndec.ac.in/">WWW.gndec.ac.in</a></P></h3>
</body>
</body>
</html>
Output

Shot 21.png Shot 21.png

Figure 18: Practical:-22

54

Potrebbero piacerti anche