Web Dev Lab Manual for IT Students
Web Dev Lab Manual for IT Students
Web Development
(3151606)
B.E. Semester 5
(Information Technology)
Institute logo
Place: __________________
Date: __________________
Preface
Main motto of any laboratory/practical/field work is for enhancing required skills as well
as creating ability amongst students to solve real time problem by developing relevant
competencies in psychomotor domain. By keeping in view, GTU has designed competency
focused outcome-based curriculum for engineering degree programs where sufficient
weightage is given to practical work. It shows importance of enhancement of skills amongst
the students and it pays attention to utilize every second of time allotted for practical
amongst students, instructors and faculty members to achieve relevant outcomes by
performing the experiments rather than having merely study type experiments. It is must
for effective implementation of competency focused outcome-based curriculum that every
practical is keenly designed to serve as a tool to develop and enhance relevant competency
required by the various industry among every student. These psychomotor skills are very
difficult to develop through traditional chalk and board content delivery method in the
classroom. Accordingly, this lab manual is designed to focus on the industry defined
relevant outcomes, rather than old practice of conducting practical to prove concept and
theory.
By using this lab manual students can go through the relevant theory and procedure in
advance before the actual performance which creates an interest and students can have
basic idea prior to performance. This in turn enhances pre-determined outcomes amongst
students. Each experiment in this manual begins with competency, industry relevant skills,
course outcomes as well as practical outcomes (objectives). The students will also achieve
safety and necessary precautions to be taken while performing practical.
This manual also provides guidelines to faculty members to facilitate student centric lab
activities through each experiment by arranging and managing necessary resources in
order that the students follow the procedures with required safety and necessary
precautions to achieve the outcomes. It also gives an idea that how students will be assessed
by providing rubrics.
In the era of digitization, the demand of Internet based applications is increasing day by
day. Web Development is one of the required skills for IT Engineer. This focuses on front-
end and back-end design. After learning Web Development students can advance their
career in the field of web development.
Utmost care has been taken while preparing this lab manual however always there is
chances of improvement. Therefore, we welcome constructive suggestions for
improvement and removal of errors if any.
Web Development(3151606)
Sr. CO CO CO CO CO CO
Objective(s) of Experiment
No. 1 2 3 4 5 6
Draw and explain architecture of the web browser.
1. List and explain various HTML request and response √
headers.
Create your resume using HTML (Suggested
sections of resume are Personal Information,
2. Educational Information, Professional Skills, √
Experience, Achievements, Hobbies), Experiment
with text, colors, link and lists.
Create your class time table using table tag,
3. experiment with rowspan, colspan, cellspacing and √
cellpadding attributes.
Design static web pages for your college containing
a description of the courses, departments, faculties,
4. √
library etc. Provide links for navigation among
pages.
Create User Registration Form in HTML (Suggested
to use fields like Name, Date of Birth, Gender, Email
5. Id, Mobile No.,Address, State , Education , Image √
Upload etc) using textbox, textarea, checkbox, radio
button, select box, button, file upload etc.
Create two web pages, one contains audios and
other page contains videos (using HTML5 audio and
6 √
video tags). Also provide link for navigation
between pages.
Create a web page using frame. Divide the page into
two parts with Navigation links on left hand side of
7. √
page (width=20%) and content page on right hand
side of page (width = 80%). On clicking the
Web Development(3151606)
21 Cookie Example √
Web Development(3151606)
The following industry relevant competency are expected to be developed in the student
by undertaking the practical work of this laboratory.
1. HTML/CSS Skills : HTML is used extensively by web developers to build web
pages. CSS is used to implement different fonts, colors and layouts in the design
of a website.
2. Javascript Skills : Java Script is used for creating interactive web pages to improve
the user experience.
3. PHP/MySql Skills : PHP/MySql is used extensively by web developers to create
fully functional dynamic web applications.
4. REST API,AJAX,JQuery Skills : REST API, AJAX, JQuery are advanced
asynchronous web communication mechanisms and used by web developers for
building highly interactive webpages.
Guidelines for Faculty members
1. Teacher should provide the guideline with demonstration of practical to the
students with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to
the students before starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in
the students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even
though not covered in the manual but are expected from the students by
concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.
Index
(Progressive Assessment Sheet)
Sr. No. Objective(s) of Experiment Page Date of Date of Assessm Sign. of Remar
No. perfor submis ent Teacher ks
mance sion Marks with
date
1 Draw and explain architecture of the web
browser. List and explain various HTML
request and response headers.
2 Create your resume using HTML (Suggested
sections of resume are Personal
Information, Educational Information,
Professional Skills, Experience,
Achievements, Hobbies), Experiment with
text, colors, link and lists.
3 Create your class time table using table tag,
experiment with rowspan, colspan,
cellspacing and cellpadding attributes.
4 Design static web pages for your college
containing a description of the courses,
departments, faculties, library etc. Provide
links for navigation among pages.
5 Create User Registration Form in HTML
(Suggested to use fields like Name, Date of
Birth, Gender, Email Id, Mobile No.,Address,
State , Education , Image Upload etc) using
textbox, textarea, checkbox, radio button,
select box, button, file upload etc.
6 Create two web pages, one contains audios and
other page contains videos (using HTML5
audio and video tags). Also provide link for
navigation between pages.
7 Create a web page using frame. Divide the
page into two parts with Navigation links on
left hand side of page (width=20%) and
content page on right hand side of page
(width = 80%). On clicking the navigation
Links corresponding content must be
shown on the right-hand side.
8 Design a web page of your home town with
an attractive background color, text color,
an Image, font etc. (use internal CSS).
Web Development(3151606)
Total
Web Development(3151606)
Experiment No: 1
Draw and explain architecture of the web browser. List and explain various
HTML request and response headers.
Date:
Relevant CO: 1
Objectives:
Theory:
The browser main functionality is to present the web resource you choose, by requesting it from the
server and displaying it on the browser window. The resource format is usually HTML but also PDF,
image and more.
USER INTERFACE
The space where interaction between users and the browser. Most of the browsers have common
inputs for user interface:
- Address bar.
- Next and back buttons.
- Buttons for home, refresh and stop
- Bookmark web pages
BROWSER ENGINE
Web Development(3151606)
Browser Engine provides methods to begin the loading of URL and other high-level browsing
actions.
- Reload, Back, Forward actions
- Error messages
- Loading progress
RENDERING ENGINE
Rendering Engine interprets (render) the HTML, XML, JavaScript and generates the layout that is
displayed in the User Interface. Key component of this phase is HTML, CSS parse.
NETWORKING
Access and transfer data on the internet (calls HTTP, HTTPS, FTP). The Networking components
handles all aspects of internet communication or security.
JAVASCRIPT INTERPRETER
Component parse & executes the JavaScript that is embedded in the website. Results of the execution
a passed to the Rendering Engines for display.
DISPLAY BACKEND
Display common UI components. Drawing basic widgets like combo boxes, windows.
DATA PERSISTENCE
HTTP client and server communicate by sending text messages. The client sends a request message
to the server. The server, in turn, returns a response message.
Web Development(3151606)
An HTTP message consists of a message header and an optional message body, separated by a blank
line, as illustrated below:
Request Headers
The request headers are in the form of name:value pairs. Multiple values, separated by commas, can
be specified.
Example
The following shows a sample HTTP request message:
HTTP protocol defines a set of request methods. A client can use one of these request methods to
send a request message to an HTTP server.
● GET: A client can use the GET request to get a web resource from the server.
● HEAD: A client can use the HEAD request to get the header that a GET request would have
obtained. Since the header contains the last-modified date of the data, this can be used to
check against the local cache copy.
● POST: Used to post data up to the web server.
● PUT: Ask the server to store the data.
● DELETE: Ask the server to delete the data.
● TRACE: Ask the server to return a diagnostic trace of the actions it takes.
● OPTIONS: Ask the server to return the list of request methods it supports.
● CONNECT: Used to tell a proxy to make a connection to another host and simply reply the
content, without attempting to parse or cache it. This is often used to make SSL connection
through the proxy.
Quiz:
Conclusion:
Web Development(3151606)
Suggested Reference:
1. https://www3.ntu.edu.sg/
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 2
Create your resume using HTML (Suggested sections of resume are Personal
Information, Educational Information, Professional Skills, Experience,
Achievements, Hobbies), Experiment with text, colors, link and list.
Date:
Relevant CO: 2
Objectives:
Theory:
HTML :
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1> Hello World </h1> -
</body>
</html> -
- DOCTYPE specifies the document type. the document type is specified by the Document Type
Definition ( DTD ).
- <head> section is used to specify title of the page using <title> tag. It is also used for adding
external css and javascript files to html document.
- HTML List allow web developers to group a set of related items in lists
o Starts with <ul> tag list item starts with <li> tag
o Lists items will be marked with bullets
o Example
<ul>
<li>C</li>
<li>C++</li>
<li>Java</li>
</ul>
o Starts with <ol> tag. Each list item starts with the <li> tag.
o Lists items will be marked with numbers by default
Web Development(3151606)
<ol>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ol>
<dl>
<dt>CE</dt>
<dd>- Computer Engineering</dd>
<dt>IT</dt>
<dd>- Information Technology</dd>
</dl>
Implementation:
Create your resume using HTML (Suggested sections of resume are Personal Information,
Educational Information, Professional Skills, Experience, Achievements, Hobbies), Experiment with
text, colors, link and list
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jatin's Resume</title>
</head>
<body>
<h1>Jatin Parmar</h1>
<p>Email: <a href="mailto:jatin@example.com">jatin@example.com</a></p>
<p>Phone: <a href="tel:+911234567890">+91 123 456 7890</a></p>
<p>LinkedIn: <a href="https://www.linkedin.com/in/jatin target="_blank">
linkedin.com/in/jatin</a></p>
<p>Location: Gujarat, India</p>
<hr>
<h2>Professional Skills</h2>
<ul>
<li>React.js</li>
<li>Node.js</li>
Web Development(3151606)
<li>Express.js</li>
<li>Material-UI</li>
<li>MongoDB</li>
<li>Azure</li>
<li>REST APIs</li>
<li>FastAPI</li>
</ul>
<hr>
<h2>Experience</h2>
<h3>Software Developer</h3>
<p>XYZ Tech Solutions, Mumbai, India | Jan 2024 – Present</p>
<ul>
<li>Developed and maintained React-based applications for various
clients.</li>
<li>Created reusable components and improved UI/UX using Material-UI.</li>
<li>Collaborated with backend teams to integrate APIs and optimize
performance.</li>
</ul>
<hr>
<h2>Educational Information</h2>
<hr>
<h2>Achievements</h2>
<ul>
<li>Winner of YourStory Digital Innovation Hackathon 2021</li>
<li>Published paper on "AI-driven Crop Recommendation" in IEEE 2023</li>
<li>Completed certification in Cloud Computing (Azure)</li>
</ul>
Web Development(3151606)
<hr>
<h2>Hobbies</h2>
<ul>
<li>Coding Competitions</li>
<li>Reading Tech Blogs</li>
<li>Hiking</li>
<li>Photography</li>
</ul>
<hr>
</body>
</html>
Output:
Web Development(3151606)
Conclusion:
In conclusion, this experiment allowed us to create a personalized resume using HTML, giving
us the opportunity to showcase important sections like personal information, education, skills,
and hobbies. By experimenting with text, colors, links, and lists, we gained hands-on experience
in organizing content effectively and improving the visual appeal of a webpage. This exercise
helped us understand how to use HTML to create structured and attractive layouts, which is a
fundamental skill in web development. Overall, it was a valuable and practical way to apply
what we’ve learned in web design.
Quiz:
• Example:
Web Development(3151606)
<!DOCTYPE html>
<html>
<head>
<title> Page Title </title>
</head>
<body>
<h1> Hello World </h1>
</body>
</html>
• DOCTYPE specifies the document type. The document type is specified by the
document type definition (DTD).
• <head> section is used to specify title of the page using <title> tag.
• It is also used for adding external CSS and JS files to html document.
Suggested Reference:
- https://www.w3schools.com/html/html_basic.asp
- https://www.w3schools.com/html/html_lists.asp
- https://www.w3schools.com/html/html_formatting.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 3
Create your class time table using table tag, experiment with rowspan, colspan,
cellspacing and cellpadding attributes.
Date:
Relevant CO: 2
Objectives:
- HTML tables allow web developers to arrange data into rows and columns.
- The <table> tag defines an HTML table.
- table row is defined with a <tr> tag.
- table header is defined with a <th> tag.
- text in <th> elements are bold and centered.
- Each table data/cell is defined with a <td>.
- By default, the text in <td> elements are regular and left-aligned.
- colspan attribute is used to make a cell span more than one column.
- rowspan attriute is used to make a call span more than one row.
- cellpadding represents the distance between cell borders and the content within a cell.
- The cellspacing attribute defines space between table cells.
- Example
o Below code is for arranging car details in tabular format.
o You may stude table tag and output as below.
Web Development(3151606)
Code Output
<table border="1">
<tr>
<th>Name</th>
<th>Color</th>
<th>Price</th>
</tr>
<tr>
<td>Swift VXI</td>
<td>Red</td>
<td>800000</td>
</tr>
<tr>
<td>Vagon R</td>
<td>White</td>
<td>600000</td>
</tr>
</table>
Implementation:
Create your class time table using table tag, experiment with rowspan, colspan, cellspacing and
cellpadding attributes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>College Timetable</title>
</head>
<body>
<thead>
<tr>
<th rowspan="2">Day/Time</th>
</tr>
<tr>
<th>Subject</th>
<th>Teacher</th>
<th>Subject</th>
<th>Teacher</th>
<th>Subject</th>
<th>Teacher</th>
<th>Subject</th>
<th>Teacher</th>
<th>Subject</th>
<th>Teacher</th>
</tr>
</thead>
<tbody>
<tr>
<td>Monday</td>
Web Development(3151606)
<td>IPDC</td>
<td>Gayatri</td>
<td>PE</td>
<td>NPD</td>
<td colspan="2">WD-LAB-SHREY</td>
<td>WD</td>
<td>BBP</td>
<td>PE</td>
<td>Rashid</td>
</tr>
<tr>
<td>Tuesday</td>
<td colspan="2">ADA-LAB-ACP</td>
</tr>
<tr>
<td>Wednesday</td>
<td colspan="2">CS-LAB-PNR</td>
<td colspan="4">Library</td>
</tr>
Web Development(3151606)
<tr>
<td>Thursday</td>
<td colspan="4">Library</td>
</tr>
<tr>
<td>Friday</td>
<td>IPDC</td>
<td>Gayatri</td>
<td>PE</td>
<td>Mehul</td>
<td colspan="2">CN-LAB-PNR</td>
</tr>
<tr>
<td>Saturday</td>
<td colspan="4">Library</td>
</tr>
Web Development(3151606)
</tbody>
</table>
</body>
</html>
Output:
Conclusion:
In conclusion, this experiment helped us create a class timetable using the HTML table tag,
allowing us to structure and display information in a clear and organized way. By
experimenting with attributes like rowspan, colspan, cellspacing, and cellpadding, we learned
how to manage the layout and appearance of the table, ensuring it is both functional and
visually appealing. This hands-on task reinforced our understanding of table formatting in
HTML, which is essential for presenting data effectively in web development projects.
Web Development(3151606)
Quiz:
• Example:
<table border="1">
<tr>
</tr>
<tr>
</tr>
</table>
• colspan:
• Example:
<table border="1">
<tr>
</tr>
Web Development(3151606)
<tr>
</tr>
</table>
<td> <th>
Position in Table Can appear in any row Typically used in the first row or
first column to denote headers
Scope Attribute Does not use the scope Can use scope attribute to specify
attribute header's relation to data
Semantic Meaning Represents cell data Represents cell headers (labels for
columns or rows)
Suggested Reference:
● https://www.w3schools.com/html/html_tables.asp
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 4
Design static web pages for your college containing a description of the courses, departments, faculties, library etc.
Provide links for navigation among pages.
Date:
Relevant CO: 2
Objectives:
Theory:
HTML Links:
Implementation:
Design static web pages for your college containing a description of the courses, departments,
faculties, library etc. Provide links for navigation among pages.
Web Development(3151606)
Home.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<header>
<nav>
<ul>
</ul>
</nav>
</header>
<br><hr><hr>
<br><hr><hr>
<main>
<section>
Web Development(3151606)
<h2>About Us</h2>
<p>Welcome to our prestigious college, offering a wide range of courses and a vibrant
campus life.</p>
</section>
</main>
<footer>
</body>
</html>
Courses.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Courses</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="Departments.html"
Web Development(3151606)
target="_blank">Departments</a></li>
</ul>
</nav>
</header>
<br><hr><hr>
<main>
<h1>Courses</h1>
</ul>
</main>
<br><hr><hr>
<footer>
</body>
</html>
Web Development(3151606)
Courses1.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Courses</title>
<style>
table,th,td{
text-align: center;
border-collapse: collapse;
</style>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="courses.html">Courses</a></li>
<li><a href="Departments.html">Departments</a></li><li><a
href="Faculty.html">Faculty</a></li>
<li><a href="Library.html">Library</a></li>
Web Development(3151606)
</ul>
</nav>
</header>
<br><hr><hr>
<h1>BE courses</h1>
<br>
<table >
<tr>
<th>Sr.no</th>
<th>Name of Course</th>
<th>Period (years)</th>
<th>Intake</th>
</tr>
<tr>
<td>1</td>
<td>4</td>
<td>120</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td>120</td>
</tr>
<tr>
Web Development(3151606)
<td>3</td>
<td>4</td>
<td>120</td>
</tr>
<tr>
<td>4</td>
<td>4</td>
<td>120</td>
</tr>
<tr>
<td>5</td>
<td>4</td>
<td>120</td>
</tr>
</table>
<br><hr><hr>
<footer>
</footer>
</body>
</html>
Web Development(3151606)
Departments.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Departments</title>
</head>
<body>
<header>
<nav>
<ul>
</ul>
</nav>
</header>
<br><hr><hr>
<main>
<h1>Departments</h1>
<ul>
Web Development(3151606)
<li><a href="/P10/P10.html" target="_blank">Information Technology</a></li>
</ul>
</main>
<br><hr><hr>
<footer>
</footer>
</body>
</html>
faculty.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Faculty Details</title>
</head>
<body>
<header>
<nav>
Web Development(3151606)
<ul>
</nav>
</header>
<br><hr><hr>
<main>
</ul>
</main>
<br><hr><hr>
<footer>
</footer>
</body>
</html>
Web Development(3151606)
facultyIT.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Faculty Details</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="courses.html">Courses</a></li>
<li><a href="Departments.html">Departments</a></li><li><a
href="Faculty.html">Faculty</a></li>
<li><a href="Library.html">Library</a></li>
</ul>
</nav>
</header>
<br><hr><hr>
<main>
<ul>
</main>
<br><hr><hr>
<footer>
</footer>
</body>
</html>
Library.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Library</title>
</head>
<body>
<header>
<nav>
<ul>
</ul>
</nav>
</header>
<br><hr> <hr>
<main>
<h2>Library</h2>
<p>Here you will find information about our library and its resources.</p>
</main>
<footer>
</footer>
</body>
</html>
Output:
Web Development(3151606)
Departments Faculty
IT dept Faculty
Web Development(3151606)
Conclusion:
In this web development experiment, we designed a set of static web pages for our college,
creating a simple yet effective online presence. By outlining the college's courses, departments,
faculties, and library, we provided a clear and organized overview of our institution. The
inclusion of navigation links between pages ensures that users can easily access and explore
different sections of the site. This project not only helped us practice basic web design skills but
also highlighted the importance of creating user- friendly and informative web pages
Quiz:
Suggested Reference:
● https://www.w3schools.com/html/html_links.asp
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 5
Create User Registration Form in HTML (Suggested to use fields like Name, Date
of Birth, Gender, Email Id, Mobile No.,Address, State , Education , Image Upload
etc) using textbox, textarea, checkbox, radio button, select box, button, file
upload etc.
Date:
Relevant CO: 2
Objectives:
</form>
</textarea>
</select>
Button Control This creates a button <input type = "button" name = "ok"
that is used to trigger a value = "OK" />
Button client-side script when
the user clicks that
button.
Web Development(3151606)
Button Control This creates a clickable <input type = "image" name =
button but we can use "imagebutton" src =
Image an image as "/html/images/logo.png" />
background of the
button.
Implementation:
Create User Registration Form in HTML (Suggested to use fields like Name, Date of Birth, Gender,
Email Id, Mobile No.,Address, State , Education , Image Upload etc) using textbox, textarea, checkbox,
radio button, select box, button, file upload etc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<form>
<div>
<label for="name">Name:</label>
Web Development(3151606)
<input type="text" id="name" name="name" required>
</div>
<br>
<div>
</div>
<br>
<div>
<label>Gender:</label>
<label for="male">Male</label>
<label for="female">Female</label>
</div>
<br>
<div>
</div>
Web Development(3151606)
<br>
<div>
</div>
<br>
<div>
<label for="address">Address:</label>
</div>
<br>
<div>
<label for="state">State:</label>
<option value="maharashtra">Maharashtra</option>
<option value="gujarat">Gujarat</option>
<option value="karnataka">Karnataka</option>
<option value="delhi">Delhi</option>
Web Development(3151606)
</select>
</div>
<br>
<div>
<label for="education">Education:</label>
<option value="phd">PhD</option>
</select>
</div>
<br>
<div>
</div>
<br>
<div>
Web Development(3151606)
<input type="checkbox" id="terms" name="terms" required>
</div>
<br>
<button type="submit">Register</button>
</form>
</body>
</html>
Output :
Web Development(3151606)
Conclusion:
Quiz:
Button Behaviour
Type
.
Suggested Reference:
● https://www.w3schools.com/html/html_forms.asp
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 6
Create two web pages, one contains audios and other page contains videos
(using HTML5 audio and video tags). Also provide link for navigation between
pages.
Date:
Relevant CO: 2
Objectives:
Theory:
HTML Video
Example :
The controls attribute adds video controls, like play, pause, and volume.
The <source> element allows you to specify alternative video files which the browser may choose
from. The browser will use the first recognized format.
The text between the <video> and </video> tags will only be displayed in browsers that do not
support the <video> element.
HTML Audio
The HTML <audio> element is used to play an audio file on a web page.
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Web Development(3151606)
The controls attribute adds audio controls, like play, pause, and volume.
The <source> element allows you to specify alternative audio files which the browser may choose
from. The browser will use the first recognized format.
Implementation:
Create two web pages, one contains audios and other page contains videos (using HTML5 audio and
video tags). Also provide link for navigation between pages.
audio.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Audio Page</title>
</head>
<body>
<h2>Audio Page</h2>
<audio controls>
</audio>
<p>Audio 1</p>
<audio controls>
<p>Audio 2</p>
<audio controls>
</audio>
<p>Audio 3</p>
<br>
</body>
</html>
video.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Video Page</title>
</head>
<body>
<h2>Video Page</h2>
</video>
<p>Video 1</p>
</video>
<p>Video 2</p>
</video>
<p>Video 3</p>
<br>
</body>
</html>
Output:
Web Development(3151606)
Conclusion:
In this experiment, we created two distinct web pages: one dedicated to audio content and the
other to video content, utilizing HTML5's audio and video tags. The audio page features various
sound files that users can play directly from the browser, while the video page showcases video
clips for streaming. Navigation links between these pages were also provided, ensuring a
seamless user experience. This project helped us explore and implement multimedia elements
in HTML5, enhancing our understanding of how to integrate and manage different types of
media on the web.
Quiz:
o The <audio> tag is used to embed audio files into a web page. It allows you to play
sound files such as music or other audio content.
o The most common audio formats supported are MP3, WAV, and Ogg. The tag
provides built-in controls like play, pause, and volume adjustment to enhance user
interaction with the audio.
o The <video> tag is used to embed video files in a web page. Like the <audio>
tag, it supports multiple formats, such as MP4 and Ogg.
o The <video> element provides users with controls to play, pause, fast-forward, rewind,
and adjust the volume, along with additional features like full-screen viewing.
Web Development(3151606)
Suggested Reference:
● https://www.w3schools.com/html/html_media.asp
● https://www.w3schools.com/html/html_media.asp
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 7
Create a web page using frame. Divide the page into two parts with Navigation
links on left hand side of page (width=20%) and content page on right hand side
of page (width = 80%). On clicking the navigation Links corresponding content
must be shown on the right-hand side.
Date:
Relevant CO: 2
Objectives:
The <frame> tag was used in HTML 4 to define one particular window (frame) within a <frameset>
HTML frames are used to divide your browser window into multiple sections where each section can
load a separate HTML document.
A collection of frames in the browser window is known as a frameset.
The window is divided into frames in a similar way the tables are organized: into rows and columns.
Creating Frames
<noframes>
<body>Your browser does not support frames.</body>
</noframes>
</frameset>
in below implementation use target attribute in navigation link to open page in specific frame.
Implementation:
Create a web page using frame. Divide the page into two parts with Navigation links on left hand side
of page (width=20%) and content page on right hand side of page (width = 80%). On clicking the
navigation Links corresponding content must be shown on the right-hand side.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iframe-based Layout</title>
<style>
body {
margin: 0;
display: flex;
#navigation {
width: 20%;
background-color: #f4f4f4;
padding: 10px;
box-sizing: border-box;
Web Development(3151606)
height: 100vh;
#content {
width: 80%;
height: 100vh;
border: none;
a{
display: block;
margin-bottom: 10px;
text-decoration: none;
color: #000;
a:hover {
color: blue;
</style>
</head>
<body>
<div id="navigation">
<h3>Navigation</h3>
</div>
Web Development(3151606)
<iframe id="content" name="content-frame" src="content1.html"></iframe>
</body>
</html>
Content1.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content 1</title>
</head>
<body>
<h2>Content 1</h2>
</body>
</html>
Content2.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content 2</title>
</head>
Web Development(3151606)
<body>
<h2>Content 2</h2>
</body>
</html>
Content3.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content 3</title>
</head>
<body>
<h2>Content 3</h2>
</body>
</html>
Web Development(3151606)
Output:
In this experiment, we created a web page layout using modern HTML and CSS techniques with
<iframe>. The design features a navigation menu on the left side and dynamic content displayed
on the right, offering a clean and responsive interface. This approach allows users to easily
switch between different content pages without reloading the entire layout. Using <iframe>
provides flexibility and better compatibility with current web standards, making it a more
suitable choice for modern web development compared to outdated methods like <frameset>.
Quiz:
• rows:
▪ Divides the window into horizontal sections. You specify the height of each
Web Development(3151606)
frame, separated by commas. You can use pixel values, percentage values,
or an asterisk (*) to specify the height.
▪ For example, rows="100, 200, *" creates three horizontal frames: the first
one is 100 pixels high, the second is 200 pixels, and the third takes up the
remaining space.
• cols:
▪ Divides the window into vertical sections. You specify the width of each
frame, separated by commas, using pixel values, percentages, or an asterisk
(*) to fill the remaining space.
▪ For example, cols="200, *" creates two vertical frames: the first is 200
pixels wide, and the second takes up the remaining width of the window
• The <iframe> tag is used to embed an inline frame (a frame inside a web page) in
HTML. An inline frame is used to embed another HTML document within the
current page.
3. Which attribute in frame tag is used to specifies the web page to load into that
frame?
• The src attribute in the <frame> or <iframe> tag is used to specify the URL of the
web page or resource to load into that frame.
• The value of the src attribute is the path to the webpage you want to display
inside the frame.
Suggested Reference:
● https://www.w3schools.com/tags/tag_frameset.asp
https://www.w3schools.com/tags/tag_frameset.asp
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 8
Design a web page of your home town with an attractive background color, text
color, an Image, font etc. (use internal CSS).
Date:
Relevant CO: 3
Objectives:
Theory:
Introduction To CSS
Example: In this example all <p> elements will be center-aligned, with a red text color
Web Development(3151606)
Code Output
<!DOCTYPE html>
<html>
<head>
<style>
p{
color: red;
text-align: center;
}
</style>
</head>
<body>
<p>Hello World!</p>
<p>These paragraphs are styled
with CSS.</p>
</body>
</html>
- p is a selector in CSS (it points to the HTML element you want to style: <p>).
- color is a property, and red is the property value
- text-align is a property, and center is the property value
CSS Selectors
p{
text-align: center;
color: red;
}
o The id selector uses the id attribute of an HTML element to select a specific element.
o The id of an element is unique within a page, so the id selector is used to select one
unique element!
o To select an element with a specific id, write a hash (#) character, followed by the id of
the element.
o Example
Web Development(3151606)
<!DOCTYPE html>
<html>
<head>
<style>
#para1 {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected
by the style.</p>
</body>
</html>
o The class selector selects HTML elements with a specific class attribute.
o To select elements with a specific class, write a period (.) character, followed by the
class name.
o Example
▪ In this example all HTML elements with class="center" will be red and center-
aligned:
<!DOCTYPE html>
<html>
<head>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="center">Red and center-
aligned heading</h1>
<p class="center">Red and center-
aligned paragraph.</p>
</body>
</html>
o The universal selector (*) selects all HTML elements on the page.
o Example
Web Development(3151606)
-
<!DOCTYPE html>
<html>
<head>
<style>
*{
text-align: center;
color: blue;
}
</style>
</head>
<body>
<h1>Hello world!</h1>
<p>Every element on the page will be
affected by the style.</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>
o The grouping selector selects all the HTML elements with the same style definitions.
o To group selectors, separate each selector with a comma.
o Example:
h1, h2, p {
text-align: center;
color: red;
}
o Some selectors can be considered different because of the way the element they belong
to works.
o For example the anchor that creates a link between documents can have pseudo
classes attached to it simply because it is not known at the time of writing the markup
what the state will be.
o It could be visited , not visited , or in the process of being selected.
o CSS pseudo-classes are used to add special effects to some selectors. You do not need
to use JavaScript or any other script to use those effects.
o selector:pseudo-class {property: value}
o CSS classes can also be used with pseudo-classes
o selector.class:pseudo-class {property: value}
Web Development(3151606)
o Example
o
a : link { color: red}
a : active { color: yellow}
a : visited { color: green}
a : hover { font-weight: bold}
a : link : hover {font-weight:bold}
- Types Of CSS
o External CSS
o Internal CSS
o Inline CSS
- Internal CSS
o An internal style sheet may be used if one single HTML page has a unique style.
o The internal style is defined inside the <style> element, inside the head section.
o Example:
<!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>
body {
background-color: lightblue;
}
<h1 style="color:Tomato;">Hello
World</h1>
Implementation:
Design a web page of your home town with an attractive background color, text color, an Image, font
etc. (use internal CSS).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to Ahmedabad</title>
<style>
body {
background-color: #f5f5dc;
color: #333;
margin: 0;
padding: 0;
Web Development(3151606)
text-align: center;
h1 {
color: #d2691e;
font-size: 3em;
margin-top: 20px;
p{
font-size: 1.2em;
line-height: 1.6;
margin: 20px;
color: #555555;
.container {
padding: 20px;
.image-container img {
max-width: 50%;
height: auto;
border-radius: 10px;
margin-top: 20px;
Web Development(3151606)
}
.footer {
background-color: #d2691e;
color: white;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
</style>
</head>
<body>
<div class="container">
<h1>Welcome to Ahmedabad</h1>
<p>Ahmedabad, the vibrant city in the heart of Gujarat, is known for its rich cultural
heritage, exquisite architecture, and bustling markets. From the serene Sabarmati
Riverfront to the historic landmarks of the old city, Ahmedabad offers a blend of tradition
and modernity that enchants every visitor.</p>
<div class="image-container">
<img src="https://ahmedabadcity.org/wp-content/uploads/2022/09/Ahmedabad-
city.jpg" alt="Ahmedabad City">
</div>
<p>Experience the beauty of this dynamic city through its stunning architecture,
delectable cuisine, and warm hospitality. Ahmedabad is a city that celebrates life, culture,
and history in every street and corner.</p>
</div>
Web Development(3151606)
<div class="footer">
</div>
</body>
</html>
Output:
Web Development(3151606)
Conclusion:
In this experiment, we designed a web page that showcases the vibrant city of Ahmedabad
using internal CSS. By applying a harmonious background color, complementary text colors,
and stylish font choices, the page offers a visually appealing and welcoming design. The use of
an image with subtle styling enhances the overall aesthetic, making the page more engaging.
Additionally, a fixed footer helps maintain a consistent theme throughout. This approach
demonstrates how internal CSS can be effectively used to create an attractive and cohesive web
page layout, enhancing user experience while highlighting the unique charm of Ahmedabad.
Quiz:
• CSS (Cascading Style Sheets) is used to style HTML elements. The syntax
consists of:
• Internal CSS refers to the use of CSS within the <style> tag placed inside the
• It allows you to apply styles to the whole page or a portion of it without creating
an external stylesheet file. Internal CSS is typically used when you want to style a
single page.
Web Development(3151606)
• Class Selector: Targets multiple elements that share the same class attribute. It
allows for styling several elements with similar attributes by referencing the class
name.
Suggested Reference:
● https://www.w3schools.com/css/css_syntax.asp
● https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
References used by the students:
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 9
Use Inline CSS to format your resume that you created in practical no 02.
Date:
Relevant CO: 3
Objectives:
Internal CSS
- An inline style may be used to apply a unique style for a single element.
- To use inline styles, add the style attribute to the relevant element. The style attribute can
contain any CSS property.
Example:
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;text-align:center;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
</body>
</html>
Implementation:
Use Inline CSS to format your resume that you created in practical no 02.
Web Development(3151606)
Output:
Web Development(3151606)
Conclusion:
In this exercise, we applied inline CSS to format the resume we created in the previous
practical. By embedding CSS styles directly within the HTML elements using the style attribute,
we were able to customize the appearance of various sections of the resume, including text
formatting, colors, and layout adjustments. This approach provided us with hands-on
experience in using inline CSS for specific, targeted styling, and demonstrated how to make
precise visual modifications directly within the HTML code.
Quiz:
• Internal CSS:
o Definition: Styles are defined within a <style> element located inside the
<head> section of an HTML document.
o Scope: The styles apply to the entire document or to specific sections of the
document as defined by the CSS rules.
o Usage: Useful when you want to apply styles to a single document without
affecting other documents. It is more efficient than inline CSS for multiple
elements and keeps the HTML code cleaner.
• Inline CSS:
o Definition: Styles are applied directly within an HTML element using the
style attribute.
o Scope: The styles affect only the single element where the inline style is
applied.
o Usage: Typically used for quick, specific changes to a single element. Inline
CSS can be less efficient and harder to manage compared to internal or
external CSS for styling multiple elements.
Web Development(3151606)
2. CSS stands for _ .
• The HTML tag used to define an internal style sheet is the <style> tag.
Suggested Reference:
● https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
Rubrics 1 2 3 Total
Marks
Web Development(3151606)
Experiment No: 10
Date:
Relevant CO: 3
Objectives:
External CSS
● An external file is a good idea when you have a number of pages, or even a complete site, which
you need to control in terms of presentation.
● it saves lots of effort as at one time you would have needed to alter each page individually.
● With an external style sheet, you can change the look of an entire website by changing just
one file!
● Each HTML page must include a reference to the external style sheet file inside the <link>
element, inside the head section.
● External CSS file must be saved with a .css extension.
● Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
Implementation:
Use External, Internal, Inline CSS to format Information Technology Department Web Pages that you
created in Practical No.04
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f9f9f9;
color: #333;
line-height: 1.6;
padding: 20px;
margin: 0;
header {
background-color: #ffa31a;
color: white;
Web Development(3151606)
padding: 10px;
text-align: center;
border-radius: 5px;
nav {
margin: 20px 0;
text-align: center;
nav a {
text-decoration: none;
color: #ffab1a;
margin: 0 15px;
font-weight: bold;
nav a:hover {
text-decoration: underline;
section {
margin-bottom: 20px;
padding: 15px;
border-radius: 5px;
background-color: #ffffff;
h2 {
color: #ffa71a;
}
Web Development(3151606)
footer {
text-align: center;
margin-top: 20px;
padding: 10px;
background-color: #ffcd1a;
color: white;
border-radius: 5px;
</style>
</head>
<body>
<header>
</header>
<nav>
<a href="/P4/home.html">Home</a>
<a href="#courses">Courses</a>
<a href="#faculty">Faculty</a>
<a href="#contact">Contact</a>
</nav>
<h2>About Us</h2>
</section>
<section>
<h2>Vision:</h2>
<p>To shape the young minds of aspiring Information Technology engineers to become the
front runner in the sustainable technological growth of our country, conserving its rich cultural
heritage and catering to its socioeconomic needs.</p>
</section>
<section>
<h2>Mission:</h2>
<ol>
<li>Infusing lifelong learning ability in the aspiring minds with the view of making them
sensible towards their social responsibilities.</li>
</ol>
</section>
<section id="courses">
<h2>Our Courses</h2>
<tr>
<th>Name of Course</th>
<th>Type</th>
Web Development(3151606)
<th>Period (Years)</th>
<th>Intake</th>
<th>Year of Starting</th>
</tr>
<tr>
<td>PG</td>
<td>2</td>
<td>30</td>
<td>1987</td>
</tr>
<tr>
<td>Information Technology</td>
<td>UG</td>
<td>4</td>
<td>120</td>
<td>2000</td>
</tr>
<tr>
<td>Information Technology</td>
<td>PG</td>
<td>2</td>
<td>18</td>
<td>2010</td>
</tr>
</table>
Web Development(3151606)
</section>
<section id="faculty">
<h2>Our Faculty</h2>
<ul>
</ul>
</section>
<section id="contact">
<h2>Contact Us</h2>
<p>Email: itdept@ldce.ac.in</p>
<p>Phone: +123-456-7890</p>
</section>
<footer>
</footer>
</body>
</html>
Web Development(3151606)
Styles.css
body {
background-color: #f9f9f9;
color: #333;
line-height: 1.6;
padding: 20px;
margin: 0;
header {
background-color: #ffa31a;
color: white;
padding: 10px;
text-align: center;
border-radius: 5px;
nav {
margin: 20px 0;
text-align: center;
nav a {
text-decoration: none;
color: #ffab1a;
margin: 0 15px;
font-weight: bold;
}
Web Development(3151606)
nav a:hover {
text-decoration: underline;
section {
margin-bottom: 20px;
padding: 15px;
border-radius: 5px;
background-color: #ffffff;
h2 {
color: #ffa71a;
footer {
text-align: center;
margin-top: 20px;
padding: 10px;
background-color: #ffcd1a;
color: white;
border-radius: 5px;
}
Web Development(3151606)
Output:
Conclusion:
Web Development(3151606)
In this exercise, we formatted the Information Technology Department web pages using all
three types of CSS: external, internal, and inline.
• External CSS was used to apply consistent styles across multiple pages by linking a
separate CSS file. This approach ensured a uniform look and feel throughout the site,
making it easy to update styles globally.
• Internal CSS was employed within specific pages to manage unique styling elements that
were distinct to those pages. This method allowed for customization without affecting
other pages.
• Inline CSS was used for immediate and specific styling needs on individual elements,
offering precise control over their appearance.
Combining these methods allowed us to create a well-styled and visually cohesive set of web
pages for the Information Technology Department, demonstrating the versatility and
application of various CSS techniques.
Quiz:
• External CSS involves using a separate CSS file to define styles for multiple HTML
documents. This CSS file is linked to the HTML documents using the <link>
element placed in the <head> section. External CSS is ideal for applying consistent
styles across multiple pages of a website, promoting reusability and easier
maintenance.
• Internal CSS:
▪ Definition: Styles are included within a <style> tag inside the <head>
section of an HTML document.
• Inline CSS:
▪ Definition: Styles are applied directly within an HTML element using the
style attribute.
▪ Scope: Affects only the specific element where the inline style is applied.
• External CSS:
▪ Definition: Styles are defined in a separate CSS file, which is linked to HTML
documents.
• The property used to change the text color of an element is the "color" property.
Jatin Parmar 220280116076
Suggested Reference:
● https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
● https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 11
Date:
Relevant CO: 4
Objectives:
Javascript
o Internal Javascript
▪ JavaScript code is placed in the head and body section of an HTML page.
▪ Example
<html>
<head>
<title>Internal JavaScript</title>
<script type="text/javascript">
document.write("Hello World.!!!");
</script>
</head>
<body>
</body>
</html>
o External javascript
▪ If you want to use the same script on several pages it could be good idea
to place the code in separate file, rather than writing it on each.
▪ JavaScript code are stored in separate external file using the .js extension
(Ex: external.js).
Jatin Parmar 220280116076
▪ Example :
HTML File : index.html
<html>
<head>
<title>External JavaScript</title>
<script type="text/javascript" src="external.js"></script>
</head>
<body>
</body>
</html>
Implementation:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Today's Date</title>
<style>
body {
text-align: center;
margin-top: 50px;
h2 {
color: #1a75ff;
Jatin Parmar 220280116076
}
</style>
</head>
<body>
<h1>Welcome!</h1>
<h2 id="dateDisplay"></h2>
<script>
function displayTodayDate() {
displayTodayDate();
</script>
</body>
</html>
Jatin Parmar 220280116076
Output :
Conclusion:
JavaScript is a versatile programming language that enables interactive web experiences and
enhances the functionality of web applications. Its ability to manipulate the Document Object
Model (DOM) allows developers to create dynamic content, respond to user actions, and
improve the overall user experience. By understanding JavaScript and its different
implementation methods—internal and external—developers can optimize their code
organization and maintainability, ultimately leading to better-performing web applications.
Quiz:
1. What is javascript?
JavaScript is a high-level, dynamic, and interpreted programming language primarily used for
enhancing the interactivity and functionality of web pages. It is an essential part of web
development alongside HTML and CSS, enabling developers to create rich, interactive user
interfaces. JavaScript supports event-driven, functional, and imperative programming styles and is
widely used for both client-side and server-side development.
Internal JavaScript: This refers to JavaScript code that is embedded directly within an HTML
document using the <script> tag. It is usually placed in the <head> or <body> section of the
HTML file. Internal JavaScript is useful for small scripts that are specific to a single page,
allowing for quick implementation without the need for additional files.
Jatin Parmar 220280116076
External JavaScript: This involves writing JavaScript code in separate .js files, which are linked
to an HTML document using the <script src="path/to/script.js"></script> tag. External JavaScript
allows for better organization and reusability of code, as the same script can be included in
multiple HTML pages. It also helps reduce the size of HTML files, leading to improved loading
times and maintainability of the codebase.
Suggested Reference:
● https://www.w3schools.com/JSREF/jsref_obj_date.asp
References used by the students:
https://www.w3schools.com/JSREF/jsref_obj_date.asp
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 12
Date:
Relevant CO: 4
Objectives:
Javascript Syntax
var x,y,z;
x=5;
y=5
z=x+y;
document.write(“total is : ”+z)
- When a web page is loaded, the browser creates a Document Object Model of the page.
- The HTML DOM model is constructed as a tree of Objects:
- Using DOM Javascript can
o change all the HTML elements in the page
o change all the HTML attributes in the page
o change all the CSS styles in the page
o remove existing HTML elements and attributes
o add new HTML elements and attributes
o react to all existing HTML events in the page
o create new HTML events in the page
Jatin Parmar 220280116076
DOM Examples
<html>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script>
</body>
</html>
<h2>Number Validation</h2>
<input id="numb">
<p id="demo"></p>
<script>
function myFunction() {
// Get the value of the input field with id="numb"
let x = document.getElementById("numb").value;
// If x is Not a Number or less than one or greater than 10
let text;
if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>
Implementation:
Develop simple calculator for addition, subtraction, multiplication and division operation
using java script.
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Calculator</title>
</head>
<body>
Jatin Parmar 220280116076
<h1>Simple Calculator</h1>
<br/>
<button onclick="calculate('add')">Add</button>
<button onclick="calculate('subtract')">Subtract</button>
<button onclick="calculate('multiply')">Multiply</button>
<button onclick="calculate('divide')">Divide</button>
<div id="result"></div>
<script>
function calculate(operation) {
let result;
if (isNaN(num1) || isNaN(num2)) {
} else {
switch (operation) {
case 'add':
break;
case 'subtract':
break;
Jatin Parmar 220280116076
case 'multiply':
break;
case 'divide':
if (num2 !== 0) {
} else {
break;
default:
document.getElementById('result').innerText = result;
</script>
</body>
</html>
Jatin Parmar 220280116076
Output :
Jatin Parmar 220280116076
Conclusion:
In conclusion, the JavaScript calculator project demonstrates the fundamental concepts of web
development, including HTML structure, CSS styling, and JavaScript functionality. This simple
application allows users to perform basic arithmetic operations while providing an interactive
interface. By using JavaScript, we can manipulate the Document Object Model (DOM) to
dynamically update the content displayed to the user, showcasing the power of JavaScript in
enhancing user experience on web pages.
Quiz:
Suggested Reference:
● https://www.w3schools.com/js/js_htmldom.asp
● https://www.w3schools.com/js/js_validation.asp
References used by the students:
Jatin Parmar 220280116076
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 13
Write a java script code to combine and display the information in textbox
when the button is clicked use registration page that you created in
Practical No.5.
Date:
Relevant CO: 4
Objectives:
1. To understand the use of DOM for getting values from Form Controls.
2. To understand event handling with javascript
Theory:
What is an Event ?
- JavaScript's interaction with HTML is handled through events that occur when the user
or the browser manipulates a page.
- When the page loads, it is called an event. When the user clicks a button, that click too
is an event. Other examples include events like pressing any key, closing a window,
resizing a window, etc.
- Developers can use these events to execute JavaScript coded responses, which cause
buttons to close windows, messages to be displayed to users, data to be validated, and
virtually any other type of response imaginable.
- Events are a part of the Document Object Model (DOM) Level 3 and every HTML
element contains a set of events which can trigger JavaScript Code.
Example : the following javascript example demonstrate how to fetch value from textbox and
display using alert()
Jatin Parmar 220280116076
<!DOCTYPE html>
<html>
<head>
<form name="myform">
UserName : <input type="text" name="username"/> <br/>
Password : <input type="email" name="email"/> <br/>
<input type="button" value="display" onclick="showData()" />
</form>
</body>
</html>
Implementation:
Write a java script code to combine and display the information in textbox when the button is
clicked use registration page that you created in Practical No.5.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script>
function displayInformation(event) {
event.preventDefault();
const userInfo = `
Name: ${name}\n
Gender: ${gender}\n
Email: ${email}\n
Mobile: ${mobile}\n
Address: ${address}\n
State: ${state}\n
Education: ${education}\n
Terms: ${terms}
`;
alert(userInfo);
</script>
</head>
<body>
Jatin Parmar 220280116076
<form onsubmit="displayInformation(event)">
<div>
<label for="name">Name:</label>
</div>
<br>
<div>
</div>
<br>
<div>
<label>Gender:</label>
<label for="male">Male</label>
<label for="female">Female</label>
</div>
<br>
Jatin Parmar 220280116076
<div>
</div>
<br>
<div>
</div>
<br>
<div>
<label for="address">Address:</label>
</div>
<br>
<div>
<label for="state">State:</label>
<option value="gujarat">Gujarat</option>
<option value="karnataka">Karnataka</option>
<option value="delhi">Delhi</option>
</select>
</div>
<br>
<div>
<label for="education">Education:</label>
<option value="phd">PhD</option>
</select>
</div>
<br>
<div>
<br>
<div>
</div>
<br>
<button type="submit">Register</button>
</form>
</body>
</html>
Jatin Parmar 220280116076
Output :
Jatin Parmar 220280116076
Conclusion:
JavaScript is a powerful and versatile programming language primarily used for enhancing user
interfaces and adding interactivity to web pages. Through event handling, JavaScript allows
developers to respond to user actions, such as clicks, key presses, or form submissions, enabling
dynamic and responsive web applications. Understanding event handling is crucial for creating
seamless user experiences.
Quiz:
Event handling in JavaScript refers to the process of capturing and responding to events that occur
in the browser, such as user interactions (clicks, keyboard inputs, mouse movements) or changes in
the document (loading a page, submitting a form). Here's an overview of key concepts related to
event handling:
Event Listeners: JavaScript uses event listeners to listen for specific events on HTML elements.
These listeners are functions that execute when a specified event occurs. For example, an onclick
event listener can be added to a button to define what happens when the button is clicked.
Event Object: When an event occurs, an event object is created that contains information about
the event, such as the type of event, the target element, and any relevant data. This object is passed
to the event handler function, allowing developers to access detailed information about the event.
Event Bubbling and Capturing: Events in JavaScript can propagate through the DOM in two
phases: capturing (from the root to the target) and bubbling (from the target back up to the root).
Developers can choose to listen for events during either phase by specifying options when adding
an event listener.
Preventing Default Behavior: Many events have default actions associated with them (e.g.,
submitting a form). Developers can use the event.preventDefault() method to stop the default
action from occurring.
Removing Event Listeners: Event listeners can be removed to stop responding to an event using
the removeEventListener method, which is useful for optimizing performance or preventing
unintended behavior.
Suggested Reference:
● https://www.w3schools.com/js/js_validation.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 14
Date:
Relevant CO: 4
Objectives:
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
</script>
</head>
<body>
<h2>JavaScript Validation</h2>
</body>
</html>
Implementation:
<html lang="en">
<head>
<meta charset="UTF-8">
<script>
function displayInformation(event) {
event.preventDefault();
// Name validation
return;
}
Jatin Parmar 220280116076
return;
// Gender validation
if (!gender) {
return;
// Email validation
if (!emailPattern.test(email)) {
return;
if (!mobilePattern.test(mobile)) {
// Address validation
return;
// State validation
return;
// Education validation
return;
if (!profilePic) {
return;
}
Jatin Parmar 220280116076
// Terms validation
if (!terms) {
return;
const userInfo = `
Name: ${name}
Gender: ${gender.value}
Email: ${email}
Mobile: ${mobile}
Address: ${address}
State: ${state}
Education: ${education}
`;
alert(userInfo);
</script>
</head>
<body>
<form onsubmit="displayInformation(event)">
<div>
<label for="name">Name:</label>
</div>
<br>
<div>
</div>
<br>
<div>
<label>Gender:</label>
<label for="male">Male</label>
<label for="female">Female</label>
</div>
<br>
<div>
Jatin Parmar 220280116076
<label for="email">Email Id:</label>
</div>
<br>
<div>
</div>
<br>
<div>
<label for="address">Address:</label>
</div>
<br>
<div>
<label for="state">State:</label>
<option value="maharashtra">Maharashtra</option>
<option value="gujarat">Gujarat</option>
Jatin Parmar 220280116076
<option value="karnataka">Karnataka</option>
<option value="delhi">Delhi</option>
</select>
</div>
<br>
<div>
<label for="education">Education:</label>
<option value="phd">PhD</option>
</select>
</div>
<br>
<div>
</div>
Jatin Parmar 220280116076
<br>
<div>
</div>
<br>
<button type="submit">Register</button>
</form>
</body>
</html>
Output :
Jatin Parmar 220280116076
Conclusion:
JavaScript form validation is a crucial aspect of web development that ensures user input is
accurate, complete, and secure before it is processed or submitted. By utilizing JavaScript for
client-side validation, developers can provide immediate feedback to users, enhancing the user
experience and preventing errors that could occur during server-side processing.
Implementing validation involves checking input values against specific criteria, such as
format, length, and required fields, using JavaScript functions. This helps maintain data
integrity, reduces the likelihood of errors, and protects against malicious input.
Jatin Parmar 220280116076
Quiz:
JavaScript form validation is a technique used to ensure that the data entered by users into a
web form meets specific criteria before it is submitted to the server. It can check for required
fields, data types, formats, and other validation rules to improve data quality and enhance user
experience.
Suggested Reference:
● https://www.w3schools.com/js/js_validation.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 15
Date:
Relevant CO: 5
Objectives:
PHP
● PHP is a server scripting language, and a powerful tool for making dynamic and
interactive Web pages.
● PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's
ASP.
● Syntax
<?php
// PHP code goes here
?>
<!DOCTYPE html>
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
Statement Syntax
Statement Syntax
Implementation:
<?php
function isPrime($number) {
if ($number <= 1) {
return false;
if ($number % $i == 0) {
return false;
return true;
}
Jatin Parmar 220280116076
$number = 29;
if (isPrime($number)) {
} else {
?>
Output :
29 is a prime number.
Conclusion:
The PHP code for checking whether a number is prime or not is a simple and efficient solution.
It uses a fnction to determine if a number is prime by checking divisibility starting from 2 up
to the square root of the number. If any divisor is found in this range, the number is declared
as non-prime. Otherwise, it is identified as prime.
Quiz:
1. PHP Tags:
Jatin Parmar 220280116076
o <?php to open PHP code.
o Short tags <? can also be used but are discouraged due to compatibility issues.
2. Variables:
o Declared with a dollar sign ($), followed by the variable name (e.g.,
$variableName).
3. Statements:
4. Comments:
5. Control Structures:
o Conditional statements (if, else, switch) and loops (for, while, foreach) are similar to
other programming languages.
foreach loop in PHP is a convenient way to iterate over arrays and objects.
provides a simple syntax for accessing each element of an array or object
without needing to use an index.
<?php
?>
Suggested Reference:
● https://www.w3schools.com/php/php_looping.asp
Date:
Relevant CO: 5
Objectives:
Accessing MySQL from PHP Note that documentation is available online here:
http://www.php.net/manual/en/ref.mysql.php
Basically, there are four things you want to be able to do in MySQL from within PHP:
Queries can be any kind of MySQL query, including SELECT, UPDATE, INSERT, etc. Using
SELECT queries, you can execute MySQL/PHP functions to put the data read from the MySQL
database into PHP variables. Then you can use the PHP variables in your PHP script to do
whatever analysis, display, etc. that you want.
echo "\t\n";
echo "\n";
// free result
mysql_free_result( $result );
Jatin Parmar 220280116076
There are three functions used here:
- To execute the query and store the result in a local variable: mysql_query()
- Parse the data read returned from the query as an array: mysql_fetch_array()
- Free the memory used by the query result: mysql_free_result()
NOTE that if the result returned is a scalar and not an array, then only mysql_query() needs
to be called and does not need to be followed by a call to mysql_fetch_array().
If errors occur, the functions return errors. These errors can be read as strings using the
function mysql_error(). Note the usage in this statement:
connect: ’.mysql_error());
mysql_close($conn);
Implementation:
Use Registration Form from practical number 5 to store user registration details in MySql
database. On submission next page displays all registration data in in html table using php.
Also provide feature to update and delete the registration data.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
Jatin Parmar 220280116076
<body>
<div>
<label for="name">Name:</label>
</div>
<br>
<div>
</div>
<br>
<div>
<label>Gender:</label>
<label for="male">Male</label>
<label for="female">Female</label>
</div>
Jatin Parmar 220280116076
<br>
<div>
</div>
<br>
<div>
</div>
<br>
<div>
<label for="address">Address:</label>
</div>
<br>
<div>
<label for="state">State:</label>
<option value="maharashtra">Maharashtra</option>
<option value="gujarat">Gujarat</option>
<option value="karnataka">Karnataka</option>
<option value="delhi">Delhi</option>
</select>
</div>
<br>
<div>
<label for="education">Education:</label>
<option value="phd">PhD</option>
</select>
</div>
<br>
<div>
</div>
<br>
<div>
</div>
<br>
<button type="submit">Register</button>
</form>
</body>
</html>
Register.php
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user_registration";
// Check connection
if ($conn->connect_error) {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$dob = $_POST['dob'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$state = $_POST['state'];
$education = $_POST['education'];
$profile_pic = null;
move_uploaded_file($_FILES['profile-pic']['tmp_name'], $profile_pic);
$sql = "INSERT INTO users (name, dob, gender, email, mobile, address, state, education,
Jatin Parmar 220280116076
profile_pic)
exit;
} else {
$conn->close();
?>
Display.php
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user_registration";
// Check connection
Jatin Parmar 220280116076
if ($conn->connect_error) {
// Handle deletion
if (isset($_GET['delete'])) {
$id = $_GET['delete'];
// Fetch users
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Registered Users</h2>
<table border="1">
<tr>
<th>ID</th>
Jatin Parmar 220280116076
<th>Name</th>
<th>DOB</th>
<th>Gender</th>
<th>Email</th>
<th>Mobile</th>
<th>Address</th>
<th>State</th>
<th>Education</th>
<th>Profile Picture</th>
<th>Actions</th>
</tr>
<tr>
<td>
<td>
</td>
</tr>
</table>
</body>
</html>
<?php
$conn->close();
?>
Update.php
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "user_registration";
if ($conn->connect_error) {
$id = $_GET['id'];
$user = $result->fetch_assoc();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$dob = $_POST['dob'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$state = $_POST['state'];
$education = $_POST['education'];
$profile_pic = $user['profile_pic'];
move_uploaded_file($_FILES['profile-pic']['tmp_name'], $profile_pic);
Jatin Parmar 220280116076
}
name='$name',
dob='$dob',
gender='$gender',
email='$email',
mobile='$mobile',
address='$address',
state='$state',
education='$education',
profile_pic='$profile_pic'
WHERE id=$id";
exit;
} else {
?>
<!DOCTYPE html>
<html lang="en">
Jatin Parmar 220280116076
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<label for="name">Name:</label>
</div>
<br>
<div>
</div>
<br>
<div>
<label>Gender:</label>
Jatin Parmar 220280116076
<input type="radio" id="male" name="gender" value="male" <?php echo
($user['gender'] == 'male') ? 'checked' : ''; ?> required>
<label for="male">Male</label>
<label for="female">Female</label>
</div>
<br>
<div>
</div>
<br>
<div>
</div>
<br>
<div>
Jatin Parmar 220280116076
<label for="address">Address:</label>
</div>
<br>
<div>
<label for="state">State:</label>
</select>
</div>
<br>
<div>
<label for="education">Education:</label>
Jatin Parmar 220280116076
<select id="education" name="education" required>
</select>
</div>
<br>
<div>
</div>
<br>
<button type="submit">Update</button>
</form>
</body>
</html>
Jatin Parmar 220280116076
Output :
Conclusion:
Quiz:
1. What is MySql?
MySQL is an open-source relational database management system (RDBMS) that uses Structured
Query Language (SQL) for managing and manipulating data. It is widely used for web applications
and is a key component of the LAMP stack (Linux, Apache, MySQL, PHP/Perl/Python). MySQL
is known for its speed, reliability, and ease of use, making it one of the most popular database
systems for developers.
// Create a connection
$conn = new mysqli($host, $user, $password, $dbname);
Jatin Parmar 220280116076
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully to the database";
Suggested Reference:
● http://www.php.net/manual/en/ref.mysql.php
References used by the students:
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 21
Cookie Example
Create HTML form with one textbox and button. Keep button label as SAVE. User will enter
color name in textbox and click on save button. On save, the value of textbox color name
should be saved in COOKIE. Whenever user opens page again, the background color should
be same as saved in cookie. Whenever user opens page again, the background color should be
same as saved in cookie.
Date:
Relevant CO: 6
Objectives:
Cookies are small pieces of data that are stored on the user's computer by the web browser
while browsing a website. They are used to remember information about the user, such as
login status, preferences, and other settings. Cookies can have expiration dates and can be
accessed by the server or client-side scripts.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cookie Example</title>
<script>
document.cookie = name + "=" + value + ";" + expires + ";path=/"; // Set the cookie
function getCookie(name) {
let c = ca[i];
function setBackgroundColor() {
if (color) {
}
Jatin Parmar 220280116076
// Function to save color on button click
function saveColor() {
window.onload = setBackgroundColor;
</script>
</head>
<body>
<button onclick="saveColor()">SAVE</button>
</body>
</html>
OUTPUT:
Jatin Parmar 220280116076
Conclusion:
In this exercise, we created a simple HTML form that allows users to save a color preference
in a cookie. Upon reopening the page, the background color reflects the saved preference,
demonstrating how cookies can be used to enhance user experience by remembering settings.
Quiz:
1. What is cookie?
A cookie is a small piece of data stored on the user's computer by the web browser while browsing
a website. Cookies are used to remember information about the user, such as login status,
preferences, and settings.
Suggested Reference:
● https://www.w3schools.com
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 17
Write a PHP script for user authentication using PHP-MYSQL. Use session
for storing username
Date:
Relevant CO: 3
Objectives:
When you work with an application, you open it, do some changes, and then you close it. This
is much like a Session. The computer knows who you are. It knows when you start the
application and when you end. But on the internet there is one problem: the web server does
not know who you are or what you do, because the HTTP address doesn't maintain state.
Session variables solve this problem by storing user information to be used across multiple
pages (e.g. username, favorite color, etc). By default, session variables last until the user closes
the browser.
So; Session variables hold information about one single user, and are available to all pages in
one application.
Session variables are set with the PHP global variable: $_SESSION.
Now, let's create a new page called "demo_session1.php". In this page, we start a new PHP
session and set some session variables:
Jatin Parmar 220280116076
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION["favcolor"]
= "green";
$_SESSION["favanimal"]
= "cat";
echo "Session variables are
set.";
?>
</body>
</html>
Next, we create another page called "demo_session2.php". From this page, we will access the
session information we set on the first page ("demo_session1.php").
Notice that session variables are not passed individually to each new page, instead they are
retrieved from the session we open at the beginning of each page (session_start()).
Also notice that all session variable values are stored in the global $_SESSION variable:
Jatin Parmar 220280116076
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Echo session variables
that were set on previous
page
echo "Favorite color is
" . $_SESSION["favcolor"]
. ".<br>";
echo "Favorite animal is
" . $_SESSION["favanimal"]
. ".";
?>
</body>
</html>
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// to change a session
variable, just overwrite it
$_SESSION["favcolor"]
= "yellow";
print_r($_SESSION);
?>
</body>
</html>
To remove all global session variables and destroy the session, use session_unset() and
session_destroy():
Jatin Parmar 220280116076
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// remove all session
variables
session_unset();
</body>
</html>
Implementation:
Write a PHP script for user authentication using PHP-MYSQL. Use session for storing
username.
SQL DataBase :-
USE user_authentication;
);
Registration page:-
<?php
// Database connection
Jatin Parmar 220280116076
$host = 'localhost';
$dbname = 'user_authentication';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
if ($stmt->execute([$username, $password])) {
} else {
?>
<!DOCTYPE html>
<html lang="en">
Jatin Parmar 220280116076
<head>
<meta charset="UTF-8">
<title>User Registration</title>
</head>
<body>
<h2>Register</h2>
<form method="post">
<label for="username">Username:</label>
<label for="password">Password:</label>
</form>
</body>
</html>
Login page ;-
<?php
// Database connection
$host = 'localhost';
$dbname = 'user_authentication';
$user = 'root';
$pass = '';
Jatin Parmar 220280116076
$conn = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
$stmt->execute([$username]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
// Verify password
$_SESSION['username'] = $username;
header("Location: welcome.php");
} else {
?>
<!DOCTYPE html>
<html lang="en">
Jatin Parmar 220280116076
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<h2>Login</h2>
<form method="post">
<label for="username">Username:</label>
<label for="password">Password:</label>
</form>
</body>
</html>
Welcome Page ;-
<?php
session_start();
if (!isset($_SESSION['username'])) {
header("Location: login.php");
exit();
}
Jatin Parmar 220280116076
// Fetch username from session
$username = $_SESSION['username'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome</title>
</head>
<body>
<a href="logout.php">Logout</a>
</body>
</html>
Logout Page :-
<?php
header("Location: login.php");
exit();
Jatin Parmar 220280116076
Output :
Conclusion:
2. Login: Users can log in by entering their credentials. The password is verifiedusing the
password_verify() function.
3. Session Management: Upon successful login, a session is started to store the user's
username. This session is used to keep the user logged in on other pages.
4. Logout: The session is destroyed upon logout, ensuring that the user is logged out.
This is a simple yet effective user authentication system using PHP and MySQL.
Quiz:
Suggested Reference:
https://www.w3schools.com/php/php_sessions.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 18
Using AJAX Create visual search feature to search using name for practical
number 16 which list name, mobile number and email id of matching
users.
Date:
Relevant CO: 6
Objectives:
What is AJAX?
AJAX = Asynchronous JavaScript And XML.
AJAX is not a programming language.
AJAX just uses a combination of:
- A browser built-in XMLHttpRequest object (to request data from a web server)
- JavaScript and HTML DOM (to display or use the data)
AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind
the scenes. This means that it is possible to update parts of a web page, without reloading the whole
page.
Ref: https://www.w3schools.com/js/js_ajax_intro.asp
Steps:
1. An event occurs in a web page (the page is loaded, a button is clicked)
2. An XMLHttpRequest object is created by JavaScript
3. The XMLHttpRequest object sends a request to a web server
4. The server processes the request
5. The server sends a response back to the web page
Jatin Parmar 220280116076
6. The response is read by JavaScript
7. Proper action (like page update) is performed by JavaScript
xhttp.onload = function() {
// What to do when the response is ready
}
xhttp.open("GET", "ajax_info.txt");
xhttp.send();
Method Description
Property Description
xhttp.onload = function() {
document.getElementById("demo").innerHTML = this.responseText;
}
xhttp.open("GET", "ajax_info.txt");
xhttp.send();
Implementation:
Using AJAX Create visual search feature to search using name for practical number 16 which
list name, mobile number and email id of matching users.
SQL:-
USE user_management;
name VARCHAR(100),
dob DATE,
gender VARCHAR(10),
email VARCHAR(100),
mobile VARCHAR(15),
address TEXT,
state VARCHAR(50),
education VARCHAR(100),
image_path VARCHAR(255)
);
HTML :-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
Jatin Parmar 220280116076
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search Users</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
.search-box {
margin: 20px 0;
table {
width: 100%;
border-collapse: collapse;
table, th, td {
th, td {
padding: 10px;
text-align: left;
</style>
</head>
<body>
<button onclick="searchUser()">Search</button>
</div>
<div id="result">
</div>
<script>
function searchUser() {
$.ajax({
url: 'search.php',
type: 'POST',
success: function(data) {
$('#result').html(data);
});
</script>
</body>
</html>
PHP ;-
Jatin Parmar 220280116076
<?php
// Database connection
$host = 'localhost';
$dbname = 'user_management';
$user = 'root';
if (isset($_POST['name'])) {
$name = $_POST['name'];
$stmt = $conn->prepare("SELECT name, mobile, email FROM users WHERE name LIKE ?");
$stmt->execute(["%$name%"]);
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($users) > 0) {
echo "<table>
<tr>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
</tr>";
<td>{$user['name']}</td>
<td>{$user['mobile']}</td>
<td>{$user['email']}</td>
</tr>";
echo "</table>";
} else {
?>
Output :
Conclusion:
This AJAX-powered visual search feature dynamically retrieves and displays matching users
based on their name input without reloading the page. You can further enhance this by adding
features like pagination, highlighting search terms, or showing a "no results found" message
when there are no matches.
Jatin Parmar 220280116076
Quiz:
1. What is Ajax?
Ans . AJAX (Asynchronous JavaScript and XML) is a web development technique
that allows web pages to communicate with a server and update content
dynamically without requiring a full page reload. It uses JavaScript to send and
retrieve data from a server asynchronously, often using formats like JSON or XML.
This results in a smoother and more interactive user experience, enabling
features like real-time updates, form submissions, and dynamic content loading.
2. Explain XMLHttpRequest.
Ans. XMLHttpRequest is a JavaScript object that enables web pages to make asynchronous
HTTP requests to a server. It is a key component of AJAX, allowing developers to fetch
data from a server or send data to it without refreshing the entire page.
Key Features:
Asynchronous Communication: Allows the web page to continue functioningwhile
the request is being processed.
Methods: Commonly uses methods like GET (to retrieve data) and POST (to send
data).
Response Handling: Supports different response formats, including JSON, XML,and
plain text.
Event Handling: Provides events such as onreadystatechange to handle the
response once it is received.
Suggested Reference:
https://www.w3schools.com/xml/ajax_intro.asp
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 19
Date:
Relevant CO: 6
Objectives:
What is REST?
REST stands for Representational State Transfer, REST is an architectural style which defines
a set of constraints for developing and consuming web services through standard protocol
(HTTP). REST API is a simple, easy to implement and stateless web service. There is another
web service available which is SOAP which stands for Simple Object Access Protocol which is
created by Microsoft.
REST API is widely used in web and mobile applications as compared to SOAP. REST can
provide output data in multiple formats such as JavaScript Object Notation (JSON), Extensible
Markup Language (XML), Command Separated Value (CSV) and many others while SOAP
described output in Web Services Description Language (WSDL).
How Does REST API Work
REST requests are related to CRUD operations (Create, Read, Update, Delete) in database,
REST uses GET, POST, PUT and DELETE requests. Let me compare them with CRUD.
▪ GET is used to retrieve information which is similar to Read
▪ POST is used to create new record which is similar to Create
▪ PUT is used to update record which is similar to Update
▪ DELETE is used to delete record which is similar to Delete
To create a table run the following query. Note: I have already attached the SQL file of this
table with dummy data, just download the complete zip file of this tutorial.
function response($order_id,$amount,$response_code,$response_desc){
$response['order_id'] = $order_id;
$response['amount'] = $amount;
$response['response_code'] = $response_code;
$response['response_desc'] = $response_desc;
$json_response = json_encode($response);
echo $json_response;
}
?>
The above script will accept the GET request and return output in the JSON format.
I have created all these files in folder name rest, now you can get the transaction information
by browsing the following URL.
http://localhost/rest/api.php?order_id=15478959
Above URL is not user friendly, therefore we will rewrite URL through the .htaccess file, copy
paste the following rule in .htaccess file.
RewriteEngine On # Turn on the rewriting engine
Now you can get the transaction information by browsing the following URL.
http://localhost/rest/api/15478959
$client = curl_init($url);
curl_setopt($client,CURLOPT_RETURNTRANSFER,true);
$response = curl_exec($client);
$result = json_decode($response);
echo "<table>";
echo "<tr><td>Order ID:</td><td>$result->order_id</td></tr>";
echo "<tr><td>Amount:</td><td>$result->amount</td></tr>";
echo "<tr><td>Response Code:</td><td>$result->response_code</td></tr>";
echo "<tr><td>Response Desc:</td><td>$result->response_desc</td></tr>";
echo "</table>";
}
?>
You can do anything with these output data, you can insert or update it into your own
database if you are using REST API of any other service provider. Usually in case of online
transaction, the service provider provides status of payment via API. You can check either
payment is made successfully or not. They also provide a complete guide of it.
Note: Make sure CURL is enabled on your web server or on your localhost when you are
testing demo.
Implementation:
SQL :-
);
PHP :-
<?php
header("Access-Control-Allow-Origin: *");
$host = 'localhost';
$dbname = 'user_management';
$user = 'root';
$pass = '';
try {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
exit();
}
Jatin Parmar 220280116076
$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'GET':
if (isset($_GET['id'])) {
// Get user by ID
$stmt->execute([$_GET['id']]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
} else {
$stmt->execute();
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($users);
break;
case 'POST':
$data = json_decode(file_get_contents("php://input"));
} else {
break;
case 'PUT':
$data = json_decode(file_get_contents("php://input"));
$fields = [];
$values = [];
if (isset($data->name)) {
$values[] = $data->name;
if (isset($data->email)) {
$values[] = $data->email;
if (isset($data->mobile)) {
$values[] = $data->mobile;
Jatin Parmar 220280116076
}
$values[] = $data->id;
$stmt = $conn->prepare("UPDATE users SET " . implode(', ', $fields) . " WHERE id = ?");
$stmt->execute($values);
} else {
break;
case 'DELETE':
// Delete a user
if (isset($_GET['id'])) {
$stmt->execute([$_GET['id']]);
} else {
break;
default:
break;
?>
Jatin Parmar 220280116076
Conclusion:
This setup provides a simple REST API using PHP and MySQL for managing users. You
can expand upon this basic structure to include more functionality, error handling, and
security features (like input validation and prepared statements). The API adheres to
REST principles and can be consumed by various clients, such as web applications,
mobile apps, and more.
Quiz:
https://www.allphptricks.com/create-and-consume-simple-rest-api-in-php/)
Rubrics 1 2 3 Total
Marks
Jatin Parmar 220280116076
Experiment No: 20
Date:
Relevant CO: 6
Objectives:
JQUERY
The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery
takes a lot of common tasks that require many lines of JavaScript code to accomplish, and
wraps them into methods that you can call with a single line of code. jQuery also simplifies a
lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.
The jQuery library contains the following features:
A. HTML/DOM manipulation
B. CSS manipulation
C. HTML event methods
D. Effects and animations
E. AJAX
There are several ways to start using jQuery on your web site.
You can:
Download the jQuery library from jQuery.com
Include jQuery from a CDN, like Google
<head>
<script src="jquery-3.6.4.min.js"></script>
</head>
OR
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js
">
</script>
</head>
The jQuery syntax is tailor-made for selecting HTML elements and performing
some action on the element(s).
Basic syntax is:
$(selector).action()
Jatin Parmar 220280116076
A $ sign to define/access jQuery
A (selector) to "query (or find)" HTML elements
A jQuery action() to be performed on the element(s)
Examples:
All jQuery methods in our examples, are inside a document ready event:
$(document).ready(function(){
});
This is to prevent any jQuery code from running before the document is finished loading (is
ready). It is good practice to wait for the document to be fully loaded and ready before
working with it. This also allows you to have your JavaScript code before the body of your
document, in the head section.
jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes,
types, attributes, values of attributes and much more. It's based on the existing CSS Selectors,
and in addition, it has some own custom selectors.
All selectors in jQuery start with the dollar sign and parentheses: $().
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
The jQuery #id selector uses the id attribute of an HTML tag to find the specific element.
An id should be unique within a page, so you should use the #id selector when you want to
find a single, unique element.
To find an element with a specific id, write a hash character, followed by the id of the HTML
element:
Jatin Parmar 220280116076
$("#test")
When a user clicks on a button, the element with id="test" will be hidden:
$(document).ready(function(){
$("button").click(function(){
$("#test").hide();
});
});
All the different visitors' actions that a web page can respond to are called events. An event
represents the precise moment when something happens.
Examples:
moving a mouse over an element
selecting a radio button
clicking on an element
The term "fires/fired" is often used with events. Example: "The keypress event is fired, the
moment you press a key". Here are some common DOM events:
In jQuery, most DOM events have an equivalent jQuery method. To assign a click event to all
paragraphs on a page, you can do this:
$("p").click();
The next step is to define what should happen when the event fires. You must pass a
function to the event:
$("p").click(function(){
// action goes here!!
});
$(document).ready()
Jatin Parmar 220280116076
The $(document).ready() method allows us to execute a function when the document is fully
loaded.
click()
The click() method attaches an event handler function to an HTML element. The function is
executed when the user clicks on the HTML element. The following example says: When a
click event fires on a <p> element; hide the current <p> element:
$("p").click(function(){
$(this).hide();
});
dblclick()
The dblclick() method attaches an event handler function to an HTML element. The function is
executed when the user double-clicks on the HTML element:
$("p").dblclick(function(){
$(this).hide();
});
mouseenter()
The mouseenter() method attaches an event handler function to an HTML element. The function
is executed when the mouse pointer enters the HTML element:
$("#p1").mouseenter(function(){
alert("You entered p1!");
});
Implementation:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Slider</title>
<style>
#slider {
Jatin Parmar 220280116076
width: 500px;
height: 300px;
overflow: hidden;
position: relative;
.slides {
display: flex;
width: 200%;
.slides img {
width: 500px;
height: 300px;
.nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
background-color: rgba(0,0,0,0.5);
color: #fff;
padding: 10px;
cursor: pointer;
.prev { left: 0; }
.next { right: 0; }
</style>
</head>
Jatin Parmar 220280116076
<body>
<div id="slider">
<div class="slides">
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var currentIndex = 0;
function showSlide(index) {
$('.next').click(function() {
showSlide(currentIndex);
});
$('.prev').click(function() {
Jatin Parmar 220280116076
currentIndex = (currentIndex - 1 + images) % images;
showSlide(currentIndex);
});
});
</script>
</body>
</html>
Output :
Conclusion:
This code creates a basic image slider with "Next" and "Prev" buttons using jQuery to
handle the transitions.
Quiz:
1. What is jquery?
Ans. jQuery is a fast, lightweight JavaScript library that simplifies HTML document
traversing, event handling, animating, and AJAX interactions for rapid web development.
It provides an easy-to-use API that works across various browsers, allowing developers
to write less code to achieve complex tasks
2. Javascript Vs. Jquery
Ans.
Definition:
- JavaScript is a programming language used for web development, enabling interactiveweb
pages.
- jQuery is a fast, lightweight JavaScript library that simplifies HTML document traversing,
event handling, animations, and AJAX interactions.
Jatin Parmar 220280116076
Syntax:
- JavaScript has a more verbose and complex syntax.
- jQuery provides a shorter and more concise syntax, making it easier to use.
Functionality:
- JavaScript can perform all web-related tasks, including DOM manipulation, animations, and
AJAX requests.
- jQuery primarily focuses on DOM manipulation, event handling, and animations.
Browser Compatibility:
- JavaScript requires manual handling for cross-browser compatibility issues.
- jQuery automatically manages cross-browser compatibility, reducing the need for extensive
coding.
Performance:
- JavaScript is generally faster because it runs natively in the browser.
- jQuery can be slightly slower due to the additional abstraction layer it introduces.
Learning Curve:
- JavaScript has a steeper learning curve, especially for beginners.
- jQuery is easier for beginners to grasp due to its simplified API.
In summary, jQuery is built on top of JavaScript to enhance its functionality and ease of
use, but having a solid understanding of JavaScript is essential for advanced web
development.
Suggested Reference:
https://www.w3schools.com/jquery/jquery_intro.asp
Rubrics 1 2 3 Total
Marks