Web_tech_Lab_Manual
Web_tech_Lab_Manual
OF
WEB TECHNOLOGY
(BCACCA1204)
USING
HTML,XML,Java Script
I Semester Academic
Session
2024-2025
Prepared By:
Mr. Somnath
Bhattacharya
TABLE OF CONTENTS
Responsibilities of Users
Users are expected to follow some fairly obvious rules of conduct:
Always:
Never:
If you are having problems or questions, please go to either the faculty, lab in-charge or the lab supporting
staff. They will help you. We need your full support and cooperation for smooth functioning of the lab.
INSTRUCTIONS
All the students are supposed to prepare the theory regarding the next experiment. Students are
supposed to bring the practical file and the lab copy.
Previous programs should be written in the practical file.
All the students must follow the instructions, failing which he/she may not be allowed in the lab.
A. LIST OF EXPERIMENTS:
10. Write an internal Document Type Definition to validate XML for CUSTOMER DETAILS.
TOTAL 100 %
Internal Assessment System
Total Marks – 10
Performance &
Attendance Discipline Recor Total
Viva
d
1 1 5 3 10
LAB PLAN
Attendance 05 minutes
Explanation of features of language 15 minutes
Explanation of experiment 15 minutes
Lab Objective
Understanding Web Fundamentals:
Learn the basics of how the web works, including the client-server model, HTTP/HTTPS
protocols, and web architecture.
HTML/CSS Proficiency:
Develop proficiency in HTML for structuring web content and CSS for styling web pages.
Create responsive web designs that work across different devices and screen sizes.
JavaScript and Front-End Development:
Gain a strong understanding of JavaScript to create dynamic and interactive web pages.
Learn to use modern JavaScript frameworks and libraries like React, Angular, or Vue.js.
Server-Side Programming:
Understand the basics of server-side programming and back-end development.
Learn to use server-side languages and frameworks.
Performance Optimization:
Learn techniques for optimizing web application performance.
Understand the importance of minimizing load times and improving user experience.
List of Lab Exercises
Sr. No. Name of experiment
1.
1(a)Create a web page using basic HTML features like tags, attributes, elements and
page title.
(b). How to install and configure a web server.
2.
Write a HTML program for demonstrating Hyperlinks.
a. Navigation from one page to another.
b. Navigation within the page.
3.
Write a HTML program to develop a static Home Page using frames.
4.
Write a HTML program to develop a static Registration Form
5.
Create the following webpage
a. Show the class time table in a tabular format.
b. Create a web page using HTML to show your geolocation.
6.
Create the following webpage
a. Show the class time table in a tabular format.
b. Create a web page using HTML to show your geolocation.
8.
Write a JavaScript program to validate the
USER LOGIN page.
9.
Write a program for implementing XML documents for CUSTOMER DETAILS.
10.
Write an internal Document Type Definition to validate XML for CUSTOMER
DETAILS.
11.
Write an internal Document Type Definition to validate XML for CUSTOMER DETAILS.
12.
Develop a static website.
Resources for all the labs
Hardware:
1. Computer
2. Peripheral
devices
Software:
• Visual Studio Code
• Visual Studio
• Notepad
Text Books:
1. Introduction to Web Technology by Pankaj Sharma
2. Web Technologies by Achyut Godbole, Atul Kahate
Reference Books:
Reference Websites:
Udemy (Paid)
FreeCodeCamp – (Free)
Microsoft Learn – (Free)
Pluralsight – (Free)
Treehouse – (Paid)
W3Schools – (Free/Paid)
Codeacademy – (Free/Paid)
Odin Project – (Free)
Experiment:1
Name of the experiment: (a) Create a web page using basic HTML features like tags, attributes,
elements and page title.
(b). How to install and configure a web server.
Solution:(a)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Web Page</title>
</head>
<body>
<header>
<h1>Welcome to My First Web Page</h1>
</header>
<nav>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<main>
<section id="about">
<h2>About Me</h2>
<p>Hi! My name is John Doe. This is my first web page. I am learning HTML and web
development.</p>
<img src="profile.jpg" alt="Profile Picture" width="200">
</section>
<section id="services">
<h2>Services</h2>
<p>Here are some services I offer:</p>
<ul>
<li>Web Development</li>
<li>Graphic Design</li>
<li>SEO Optimization</li>
</ul>
</section>
<section id="contact">
<h2>Contact Me</h2>
<form action="submit_form.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<br>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" cols="50"></textarea>
<br>
<input type="submit" value="Submit">
</form>
</section>
</main>
<footer>
<p>© 2024 John Doe. All rights reserved.</p>
</footer>
</body>
</html>
Output:
1(b):
Installing and configuring a web server on a Windows platform can be done using various software, but
one of the most popular and widely used options is IIS (Internet Information Services). Below is a step-
by-step guide to help you install and configure IIS on Windows.
Step 1: Install IIS
1. Open the Control Panel:
o Click on the Start menu and type "Control Panel," then press Enter.
2. Go to Programs and Features:
o Click on Programs and then Programs and Features.
3. Turn Windows features on or off:
o In the left-hand sidebar, click on Turn Windows features on or off.
4. Enable IIS:
o In the Windows Features dialog, check the box for Internet Information Services.
o Expand the Internet Information Services tree to ensure that the necessary features are
selected. For a basic setup, the default options are sufficient, but you can also select
additional features as needed.
o Click OK and wait for the installation to complete.
Step 2: Verify the Installation
1. Open a Web Browser:
o Open any web browser and enter http://localhost.
2. Check the Default IIS Page:
o You should see the default IIS welcome page, which means IIS is installed and running.
Step 3: Configure IIS
1. Open the IIS Manager:
o Click on the Start menu, type "IIS Manager," and press Enter.
2. Add a New Website:
o In the IIS Manager, expand the node for your computer in the left-hand Connections pane.
o Right-click on Sites and select Add Website.
3. Fill in the Site Information:
o Site name: Enter a name for your site.
o Physical path: Browse to or create a directory where your site's files will be stored (e.g.,
C:\inetpub\wwwroot\yoursite).
o Binding: Select the type (typically http), IP address, and port (usually 80 for HTTP).
o Click OK to create the site.
4. Configure the Site:
o Click on your newly created site in the left-hand Connections pane.
o In the center pane, you can configure various settings like authentication, SSL, default
documents, etc.
Step 4: Set Up Directory and Permissions
1. Create Directory Structure:
o If you haven’t already, create the directory structure for your site (e.g.,
C:\inetpub\wwwroot\yoursite).
2. Set Permissions:
o Right-click on your site’s folder, select Properties, then go to the Security tab.
o Ensure that the IIS_IUSRS group has appropriate permissions to read and execute files.
Step 5: Create an Index Page
1. Create a Simple HTML Page:
o Open Notepad (or any text editor) and create an index.html file with some basic HTML
content:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Your Site!</title>
</head>
<body>
<h1>Success! Your IIS server is configured correctly.</h1>
</body>
</html>
Experiment:2
File1: index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hyperlink Demonstration</title>
</head>
<body>
<h1>Welcome to the Hyperlink Demonstration</h1>
<p>This page demonstrates hyperlinks.</p>
File 2:page2.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page 2</title>
</head>
<body>
<h1>Welcome to Page 2</h1>
<p>This is the second page.</p>
File 1: index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page with Frames</title>
</head>
<frameset rows="20%,*">
<frame src="header.html" name="headerFrame">
<frameset cols="20%,*">
<frame src="menu.html" name="menuFrame">
<frame src="content.html" name="contentFrame">
</frameset>
</frameset>
<noframes>
<body>
<p>Your browser does not support frames. Please update your browser.</p>
</body>
</noframes>
</html>
File 2: header.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Header</title>
</head>
<body>
<h1>Welcome to My Website</h1>
</body>
</html>
File 3: menu.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menu</title>
</head>
<body>
<ul>
<li><a href="content.html" target="contentFrame">Home</a></li>
<li><a href="about.html" target="contentFrame">About</a></li>
<li><a href="contact.html" target="contentFrame">Contact</a></li>
</ul>
</body>
</html>
File 4: content.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Content</title>
</head>
<body>
<h2>Home Page</h2>
<p>This is the home page content.</p>
</body>
</html>
File 5: about.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About</title>
</head>
<body>
<h2>About Us</h2>
<p>This is the about us page content.</p>
</body>
</html>
File 6: contact.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact</title>
</head>
<body>
<h2>Contact Us</h2>
<p>This is the contact page content.</p>
</body>
</html>
Explanation:
index.html: This is the main page that uses frames to divide the layout. The outer
<frameset> divides the page into two rows: the header (20%) and the main content
area. The inner <frameset> divides the main content area into two columns: the
menu (20%) and the main content frame.
header.html: This file contains the header of the website.
menu.html: This file contains the navigation menu with links that load different
content into the contentFrame.
content.html, about.html, and contact.html: These files contain the content for the
home, about, and contact pages, respectively.
Save these files in the same directory and open index.html in your web browser to see the
frames in action. However, for modern web development, consider using CSS Grid or Flexbox
for layout purposes.
Output:
Experiment:04
Write a HTML program to develop a static Registration Form.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h2 {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>Registration Form</h2>
<form>
<label for="firstname">First Name</label>
<input type="text" id="firstname" name="firstname" required>
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
<label for="confirm_password">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password"
required>
<button type="submit">Register</button>
</form>
</div>
</body>
</html>
Output:
This HTML code creates a registration form with fields for the first name, last name, email,
password, and password confirmation. It also includes basic CSS for styling. The form is
static and does not perform any actions when submitted. You can add backend functionality
or JavaScript validation to enhance it further.
Experiment:05
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class Timetable</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
table {
border-collapse: collapse;
width: 80%;
background-color: white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: center;
}
th {
background-color: #4CAF50;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:hover {
background-color: #ddd;
}
caption {
margin-bottom: 10px;
font-size: 1.5em;
font-weight: bold;
}
</style>
</head>
<body>
<table>
<caption>Class Timetable</caption>
<tr>
<th>Day/Time</th>
<th>9:00 - 10:00</th>
<th>10:00 - 11:00</th>
<th>11:00 - 12:00</th>
<th>12:00 - 1:00</th>
<th>1:00 - 2:00</th>
<th>2:00 - 3:00</th>
<th>3:00 - 4:00</th>
</tr>
<tr>
<td>Monday</td>
<td>Math</td>
<td>English</td>
<td>Physics</td>
<td>Lunch</td>
<td>Chemistry</td>
<td>History</td>
<td>Art</td>
</tr>
<tr>
<td>Tuesday</td>
<td>Biology</td>
<td>Math</td>
<td>English</td>
<td>Lunch</td>
<td>PE</td>
<td>Physics</td>
<td>Geography</td>
</tr>
<tr>
<td>Wednesday</td>
<td>Chemistry</td>
<td>History</td>
<td>Math</td>
<td>Lunch</td>
<td>English</td>
<td>PE</td>
<td>Computer Science</td>
</tr>
<tr>
<td>Thursday</td>
<td>Physics</td>
<td>Geography</td>
<td>Biology</td>
<td>Lunch</td>
<td>Math</td>
<td>History</td>
<td>Art</td>
</tr>
<tr>
<td>Friday</td>
<td>English</td>
<td>PE</td>
<td>Math</td>
<td>Lunch</td>
<td>Physics</td>
<td>Chemistry</td>
<td>Computer Science</td>
</tr>
</table>
</body>
</html>
Output:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Geolocation Example</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
}
#map {
height: 400px;
width: 100%;
}
</style>
</head>
<body>
<h1>Show Your Geolocation</h1>
<button onclick="getLocation()">Show My Location</button>
<p id="status"></p>
<div id="map"></div>
<script>
function getLocation() {
const status = document.getElementById('status');
const map = document.getElementById('map');
if (navigator.geolocation) {
status.textContent = 'Locating…';
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
status.textContent = 'Geolocation is not supported by this browser.';
}
}
function showPosition(position) {
const status = document.getElementById('status');
const map = document.getElementById('map');
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
function showError(error) {
const status = document.getElementById('status');
switch (error.code) {
case error.PERMISSION_DENIED:
status.textContent = 'User denied the request for Geolocation.';
break;
case error.POSITION_UNAVAILABLE:
status.textContent = 'Location information is unavailable.';
break;
case error.TIMEOUT:
status.textContent = 'The request to get user location timed out.';
break;
case error.UNKNOWN_ERROR:
status.textContent = 'An unknown error occurred.';
break;
}
}
</script>
</body>
</html>
Output:
Experiment:07
Write HTML for demonstration of cascading style sheets.
a. Embedded stylesheets.
b. External stylesheets.
c. Inline styles.
Experiment: 08
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Login</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.container {
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h2 {
margin-bottom: 20px;
text-align: center;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.error {
color: red;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="container">
<h2>User Login</h2>
<div id="error" class="error"></div>
<form id="loginForm" onsubmit="return validateForm()">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
<button type="submit">Login</button>
</form>
</div>
<script>
function validateForm() {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const errorDiv = document.getElementById('error');
errorDiv.textContent = '';
if (password.length < 6) {
errorDiv.textContent = 'Password must be at least 6 characters long.';
return false;
}
alert('Login successful!');
return true;
}
</script>
</body>
</html>
Explanation:
1. HTML Structure:
o The login form consists of two input fields: one for the username and one for
the password.
o There is also a submit button to log in.
o An error message will be displayed in a div with the id error.
2. CSS Styles:
o Basic styles are applied to make the form look presentable.
3. JavaScript Validation:
o The validateForm function is called when the form is submitted.
o The function checks if the username and password fields are not empty.
o It also includes additional validation, such as minimum length requirements.
o A placeholder authentication check is included, which you can replace with
actual authentication logic.
o If any validation fails, an error message is displayed and the form is not
submitted.
You can further customize the validation logic as needed for your specific requirements.
4o.
Experiment:09
File: customer_details.xml
Experiment:10
Write an internal Document Type Definition to validate XML for CUSTOMER DETAILS.
<!ELEMENT id (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT address (street, city, state, zip)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT email (#PCDATA)>
Output:
Experiment:11
Write an internal Document Type Definition to validate XML for CUSTOMER DETAILS.
<!DOCTYPE customers [
]>
<customers>
<customer id="C001">
<name>John Doe</name>
<address>
<city>Springfield</city>
<state>IL</state>
<zip>62701</zip>
</address>
<email>[email protected]</email>
<phone>555-1234</phone>
</customer>
<customer id="C002">
<name>Jane Smith</name>
<address>
<city>Springfield</city>
<state>IL</state>
<zip>62702</zip>
</address>
<email>[email protected]</email>
<phone>555-5678</phone>
</customer>
</customers>
An internal Document Type Definition (DTD) can be used to validate XML documents for
CUSTOMER DETAILS. Below is an example of an internal DTD for customer details, which
includes elements like customer, name, address, email, and phone.
Explanation
Root Element:
o The root element is customers, which can contain one or more customer
elements.
Customer Element:
o The customer element must contain name, address, email, and phone elements in
that order.
Name Element:
Address Element:
o The address element contains street, city, state, and zip elements in that order.
o Both email and phone elements contain parsed character data (#PCDATA).
This DTD ensures that each customer element has a unique id and contains the required child
elements in the specified order. The document structure and data types are validated against
this DTD.
Experiment:12
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Static Website</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to My Static Website</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home">
<h2>Home</h2>
<p>This is the home page of my static website.</p>
</section>
<section id="about">
<h2>About</h2>
<p>This section contains information about me.</p>
</section>
<section id="contact">
<h2>Contact</h2>
<p>Here is how you can contact me.</p>
</section>
</main>
<footer>
<p>© 2024 My Static Website</p>
</footer>
<script src="script.js"></script>
</body>
</html>
Style.css
/* Basic reset */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Body styling */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
padding: 20px;
}
/* Header styling */
header {
background: #333;
color: #fff;
padding: 10px 0;
text-align: center;
}
/* Navigation styling */
nav ul {
list-style: none;
padding: 0;
}
nav ul li {
display: inline;
margin: 0 10px;
}
nav ul li a {
color: #fff;
text-decoration: none;
}
section {
margin-bottom: 20px;
}
/* Footer styling */
footer {
background: #333;
color: #fff;
text-align: center;
padding: 10px 0;
position: fixed;
bottom: 0;
width: 100%;
}
Script.js
document.addEventListener('DOMContentLoaded', () => {
console.log('JavaScript is loaded and ready!');
});