WD Lab Manual
WD Lab Manual
Web Development
(3151606)
B.E. Semester5
(Information Technology)
Institute logo
1
220280116008 Batva Pooja
Place: __________________
Date: __________________
2
220280116008 Batva Pooja
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-basedcurriculum 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 createsan 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 studentcentric 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.
1
220280116008 Batva Pooja
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
6 √
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
2
220280116008 Batva Pooja
21 Cookie Example √
3
220280116008 Batva Pooja
5
220280116008 Batva Pooja
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 Uploadetc) 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).
9 Use Inline CSS to format your resume that
you created in practical no 02.
6
220280116008 Batva Pooja
7
220280116008 Batva Pooja
8
220280116008 Batva Pooja
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
9
220280116008 Batva Pooja
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.
10
220280116008 Batva Pooja
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:
11
220280116008 Batva Pooja
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:
12
220280116008 Batva Pooja
Edge
User Interface
Rendering Engine
Conclusion:
In this experiment we learnt about Web Browser and it’s architecture, HTTP requests and
response message format, along with various HTTP request methods.
Suggested Reference:
1. https://www3.ntu.edu.sg/
Rubrics 1 2 3 Total
Marks
13
220280116008 Batva Pooja
Experiment No: 2
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.
14
220280116008 Batva Pooja
- Editors like notepad, notepad++, sublime text, visual studio code can be used to write
html code
- Save html document file with .html extension
- To check output open html document with browser like google chrome , Microsoft
edge, Firefox etc.
HTML Formatting Tags
- 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
15
220280116008 Batva Pooja
<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>Resume</title>
</head>
<body>
<div class="body">
<header>
<h1> <font color="navy"> POOJA BATVA </font></h1>
<h2> <font color="navy">SOFTWARE ENGINEER</font></h2>
</header><hr>
<section class="contact">
<h3> <font color="navy">CONTACT</font></h3>
<label for="phoneno">Phone No :</label>
<a href="93XXX XXXXX">93XXX XXXXX</a><br>
<label for="email">Email :</label>
<a href="[email protected]">[email protected]</a><br>
<label for="githun">GitHub :</label>
<a href="github/Pooja-Batva">github/Pooja-Batva</a><br>
<label for="Linkedin">Linked in :</label>
<a href="linkedin/pooja-batva">linkedin/pooja-batva</a>
</section><hr>
<section class="expertise">
<h3> <font color="navy">EXPERTISE SKILLS</font></h3>
<ul>
<li>C</li>
<li>JAVA</li>
16
220280116008 Batva Pooja
<li>Frontend Developer</li>
<li>Data Science</li>
</ul>
</section><hr>
<section class="language">
<h3><font color="navy">LANGUAGE</font></h3>
<ul>
<li>Gujarati</li>
<li>Hindi</li>
<li>English</li>
</ul>
</section><hr>
<section class="interest">
<h3><font color="navy">INTEREST</font></h3>
<ul>
<li>Drawing</li>
<li>Games</li>
</ul>
</section><hr>
<section class="profprofile">
<h3><font color="navy">PROFESSIONAL PROFILE</font></h3>
<ul>
<li>Dedicated IT engineering student with a strong foundation in software development, computer networks,
and data science.</li>
<li>Hands-on experience in frontend development.</li>
<li>Proficient in programming languages such as C and Java.</li>
</ul>
</section><hr>
<section class="education">
<h3><font color="navy">EDUCATION</font></h3>
<ul>
<h4>Becholar of Engineering</h4>
<ul>
<li>L.D. College of Engineering</li>
<li>CGPA : 8.00</li>
</ul>
<h4>HSC</h4>
<ul>
<li>Sigma school of science</li>
<li>Persentage : 80.00%</li>
</ul>
</ul>
</section><hr>
<section class="experiance">
<h3> <font color="navy">EXPERIENCE</font></h3>
<li>Hack4Purpose - Hackathon</li>
<p>Hack4Purpose is an annual hackathon designed to inspire engineering and management students to
address global challenges in alignment with the United Nations' Sustainable Development Goals (SDGs). It is
scheduled for June 26-27, 2024 in Chennai, India. Participants are encouraged to propose innovative solutions, either
based on provided data or their own ideas, focusing on sustainability and social impact.</p>
</section><hr>
</div>
</body>
</html>
17
220280116008 Batva Pooja
Output:
18
220280116008 Batva Pooja
Conclusion:
In this experiment we learnt about designing a resume in HTML enabling customization and
creativity, providing a unique way to showcase your qualifications and skills thereby
enhancing understanding of HTML and CSS.
Quiz:
19
220280116008 Batva Pooja
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: MDN & Google
20
220280116008 Batva Pooja
Rubrics 1 2 3 Total
Marks
21
220280116008 Batva Pooja
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.
22
220280116008 Batva Pooja
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.
23
220280116008 Batva Pooja
</tr> <th>SAT</th>
<tr> <td colspan="4">
<th>TUE</th> DE_2A-A1-BBP <br>
<td>CN <br> PNR</td> DE_2A-A2-PNR <br>
<td>CN <br> PNR</td> DE_2A-A3-SAS <br>
<td colspan="2"> DE_2A-A4-NPD <br>
WD-A1-BBP <br> </td>
WD-A2-AJP <br> <td>Library</td>
ADA-A3-MCP <br> <td>Library</td>
ADA-A4-MEHUL <br> </tr>
</td> </table>
<td>WD <br> BBP</td> </body>
<td>WD <br> BBP</td> </html>
</tr>
Output:
Conclusion:
This experiment represents the timetable representing the effective use of HTML table tags
along with rowspan, colspan, cellspacing, and cellpadding attributes to organize and present
structured data clearly. The resulting layout is both visually consistent and easy to read,
making it a useful tool for schedule management
Quiz:
24
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/html/html_tables.asp
Rubrics 1 2 3 Total
Marks
25
220280116008 Batva Pooja
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:
26
220280116008 Batva Pooja
Implementation:
Design static web pages for your college containing a description of the courses,
departments, faculties, library etc. Provide links for navigation among pages.
ClgWeb.html cstyle.css
<!DOCTYPE html> body {
<html lang="en"> font-family: Arial, sans-serif;
<head> margin: 0;
<meta charset="UTF-8"> padding: 0;
<meta name="viewport" content="width=device-width, background-color: #f4f4f4;
initial-scale=1.0"> }
<title>LDCE - Home</title> header img {
<link rel="stylesheet" href="cstyle.css"> height: 80px;
<style> }
.container { nav {
height: 65vh; background-color: #000000;
padding: 20px; overflow: hidden;
display: flex; }
align-items: center; nav ul {
list-style: none;
} margin: 0;
.container img { padding: 0;
width: 100%; }
margin:50px; nav ul li {
border-radius: 8px; float: left;
} }
</style> nav ul li a {
</head> display: block;
<body> padding: 14px 20px;
<header> text-decoration: none;
<img src="ldce.png" alt="LDCE Logo"> color: white;
</header> }
<nav> nav ul li a:hover {
<ul> background-color: #575757;
<li><a href="ClgWeb.html">Home</a></li> }
<li><a href="courses.html">Courses</a></li>
<li><a href="departments.html">Departments</a></li> footer {
<li><a href="faculties.html">Faculties</a></li> background-color: #000000;
<li><a href="library.html">Library</a></li> color: white;
</ul> text-align: center;
</nav> padding: 10px 0;
<div class="container"> position: fixed;
<img src="campus.png" alt="LDCE Campus Photo"> width: 100%;
<span> bottom: 0;
<h1>Welcome to LDCE</h1> }
<p>One of the oldest and premier engineering institutes
in Gujarat, known for its excellence in education and
infrastructure.</p> Departments.html
<p>L. D. College of Engineering endearingly known as <!DOCTYPE html>
L.D.C.E is Ahmedabad’s premier engineering college <html lang="en">
situated at the city’s heart and surrounded by elite <head>
organization like PRL, ATIRA, ISRO, IIM and CEPT. <meta charset="UTF-8">
Starting in 1948 to impart quality higher education in <meta name="viewport" content="width=device-width,
various fields of engineering, it has seen unprecedented initial-scale=1.0">
growth.</p> <title>LDCE - Departments</title>
<p>It is affiliated with Gujarat Technological University & <link rel="stylesheet" href="cstyle.css">
administrated by Department of Technical Education, </head>
Government of Gujarat.</p> <body>
</span>
27
220280116008 Batva Pooja
</div> <header>
<footer> <img src="ldce.png" alt="LDCE Logo">
<p>© 2024 LD College of Engineering. All rights </header>
reserved.</p>
</footer> <nav>
</body> <ul>
</html> <li><a href="ClgWeb.html">Home</a></li>
<li><a href="courses.html">Courses</a></li>
Course.html <li><a
<!DOCTYPE html> href="departments.html">Departments</a></li>
<html lang="en"> <li><a href="faculties.html">Faculties</a></li>
<head> <li><a href="library.html">Library</a></li>
<meta charset="UTF-8"> </ul>
<meta name="viewport" content="width=device-width, </nav>
initial-scale=1.0">
<title>LDCE - Courses</title> <div class="container">
<link rel="stylesheet" href="cstyle.css"> <h1>LDCE Library</h1>
</head>
<body> <section id="about">
<h2>About the Library</h2>
<header> <p>Welcome to the LDCE Library! Our library offers
<img src="ldce.png" alt="LDCE Logo"> a wide range of books, journals, and digital resources to
</header> support the academic and research needs of our students
and faculty.</p>
<nav> </section>
<ul>
<li><a href="ClgWeb.html">Home</a></li> <section id="services">
<li><a href="courses.html">Courses</a></li> <h2>Services</h2>
<li><a <ul>
href="departments.html">Departments</a></li> <li>Book Lending</li>
<li><a href="faculties.html">Faculties</a></li> <li>Digital Resources</li>
<li><a href="library.html">Library</a></li> <li>Study Rooms</li>
</ul> </ul>
</nav> </section>
<footer>
<p>© 2024 LD College of Engineering. All rights
reserved.</p>
</footer>
28
220280116008 Batva Pooja
Library.html
<!DOCTYPE html> </body>
<html lang="en"> </html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>LDCE - Library</title>
<link rel="stylesheet" href="cstyle.css"> Faculties.html
</head> <!DOCTYPE html>
<body> <html lang="en">
<head>
<header> <meta charset="UTF-8">
<img src="ldce.png" alt="LDCE Logo"> <meta name="viewport" content="width=device-width,
</header> initial-scale=1.0">
<title>LDCE - Faculties</title>
<nav> <link rel="stylesheet" href="cstyle.css">
<ul> </head>
<li><a href="ClgWeb.html">Home</a></li> <body>
<li><a href="courses.html">Courses</a></li>
<li><a <header>
href="departments.html">Departments</a></li> <img src="ldce.png" alt="LDCE Logo">
<li><a href="faculties.html">Faculties</a></li> </header>
<li><a href="library.html">Library</a></li>
</ul> <nav>
</nav> <ul>
<li><a href="ClgWeb.html">Home</a></li>
<div class="container"> <li><a href="courses.html">Courses</a></li>
<h1>LDCE Library</h1> <li><a
href="departments.html">Departments</a></li>
<section id="about"> <li><a href="faculties.html">Faculties</a></li>
<h2>About the Library</h2> <li><a href="library.html">Library</a></li>
<p>Welcome to the LDCE Library! Our library offers </ul>
a wide range of books, journals, and digital resources to </nav>
support the academic and research needs of our students
and faculty.</p> <div class="container">
</section> <h1>Faculties</h1>
<p>Faculties of IT Department</p>
<section id="services"> <ul>
<h2>Services</h2> <li>Dr. Hiteishi Diwanji</li>
<ul> <li>Dr. Mehul Parikh</li>
<li>Book Lending</li> <li>BAKULBHAI PANCHAL</li>
<li>Digital Resources</li> <li>Miss. Nirjari Desai</li>
<li>Study Rooms</li> <li>Miss. Mital Panchal</li>
</ul> <li>Dr. Pradip Patel</li>
</section> <li>MANOJKUMAR PATEL</li>
<li>Miss. ALKA PATEL</li>
<section id="timing"> <li>Mr. Ankit Patel</li>
<h2>Library Timing</h2> <li>Mrs. Shital Solanki</li>
<table> <li>Mrs. Madhuri Patel</li>
<tr> <li>Miss. Vidisha Thakkar</li>
<th>Day</th> <li>Mr. JAIMINKUMAR CHAVDA</li>
<th>Opening Hours</th> <li>Dr. PURVI RAMANUJ</li>
</tr> <li>Mrs. JAHNAVI TEJASKUMAR PATEL</li>
<tr> <li>Mrs. SWATI PATEL</li>
<td>Monday - Friday</td> <li>Dr. Kuntesh Jani </li>
<td>9:00 AM - 6:00 PM</td> </ul>
</tr> </div>
<tr>
<td>Saturday</td> <footer>
<td>9:00 AM - 1:00 PM</td> <p>© 2024 LD College of Engineering. All rights
29
220280116008 Batva Pooja
</tr> reserved.</p>
<tr> </footer>
<td>Sunday</td>
<td>Closed</td> </body>
</tr> </html>
</table>
</section>
</div>
<footer>
<p>© 2024 LD College of Engineering. All rights
reserved.</p>
</footer>
</body>
</html>
Output:
30
220280116008 Batva Pooja
31
220280116008 Batva Pooja
Conclusion:
The HTML page provides a clear overview of the undergraduate courses offered at LDCE and detailed
information about the institution's Central Library. It effectively organizes course details and library
resources, enhancing accessibility and understanding for users.
Quiz:
Suggested Reference:
https://www.w3schools.com/html/html_links.asp
Rubrics 1 2 3 Total
Marks
32
220280116008 Batva Pooja
Experiment No: 5
Date:
Relevant CO: 2
Objectives:
</form>
33
220280116008 Batva Pooja
</textarea>
Checkbox Control Checkboxes are used <input type = "checkbox" name =
when more than one "maths" value = “maths"> Maths
option is required to be
selected. <input type = "checkbox" name =
"physics" value = “physics"> Physics
34
220280116008 Batva Pooja
</select>
35
220280116008 Batva Pooja
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
Form.html Form.css
<!DOCTYPE html> *{
<html lang="en"> padding: 0;
<head> margin: 0;
<meta charset="UTF-8" /> font-family: Arial, Helvetica, sans-serif;
<meta name="viewport" content="width=device-width, }
initial-scale=1.0" />
<title>Registration Form</title> body{
<link rel="stylesheet" href="Form.css" /> background-color: rgb(236, 253, 255);
</head> }
<body>
<div class="container"> .container{
<header>Registration Form</header> background-color: white;
<form action="#" method="post"> width: 50%;
<div class="fullname"> margin: auto;
<label for="fullname">Full Name</label> box-shadow: 0 0 15px rgb(155, 199, 205);
<input display: flex;
type="text" flex-direction: column;
name="fullname" align-items: center;
placeholder="Enter Your fullname" padding: 25px;
/> }
</div>
<div class="email"> .container header{
<label for="email">Email Id</label> color: navy;
<input type="email" name="email" font-size: 30px;
placeholder="Enter Your email id" /> font-weight: 500;
</div> padding: 25px;
<section> }
<div class="mobileno">
<label for="mobileno">Mobile No.</label> form{
<input type="number" name="mobileno" size="10" width: 100%;
/> display: flex;
</div> flex-direction: column;
<div class="dob"> gap: 20px;
<label for="dob">Date Of Birth</label> }
<input type="date" name="dob" />
</div> form input,textarea{
</section> height: 50px;
36
220280116008 Batva Pooja
37
220280116008 Batva Pooja
Pradesh</option>
<option
value="Uttarakhand">Uttarakhand</option>
<option value="West Bengal">West
Bengal</option>
</select>
</div>
<div class="image">
<label for="image">Upload Image</label>
<input type="file" name="fileupload"
accept="image/*" />
</div>
</section>
<section>
<input type="submit" value="submit" />
<input type="reset" value="reset" />
</section>
</form>
</div>
</body>
</html>
Output :
Conclusion:
38
220280116008 Batva Pooja
Through this experiment we learnt about HTML User Registration Form which efficiently captures
essential user details using a variety of input elements. It is designed to be both comprehensive and
user-friendly
Quiz:
Suggested Reference:
https://www.w3schools.com/html/html_forms.asp
Rubrics 1 2 3 Total
Marks
39
220280116008 Batva Pooja
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
<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>
40
220280116008 Batva Pooja
The HTML <audio> element is used to play an audio file on a web page.
The controlsattribute 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 Video.html
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, <meta name="viewport" content="width=device-width,
initial-scale=1.0"> initial-scale=1.0">
<title>Audio Page</title> <title>Video Page</title>
</head> </head>
<body> <body>
<h1>Audio Page</h1> <h1>Video Page</h1>
<video width="320" height="240" controls>
<audio controls> <source src="movie.mp4" type="video/mp4">
<source src="audiofile.mp3" type="audio/mpeg"> </video>
</audio> <video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<br><br> </video>
<br><br>
<audio controls> <a href="Audio.html">Go to Audio Page</a>
<source src="anotheraudiofile.ogg" </body>
type="audio/ogg"> </html>
</audio>
<br><br>
<a href="video.html">Go to Video Page</a>
</body>
</html>
Output:
41
220280116008 Batva Pooja
Conclusion:
Creating linked web pages with HTML5 audio and video tags enhances multimedia interaction on
your site. It ensures a smooth user experience with easy navigation between different types of
content.
Quiz:
Suggested Reference:
https://www.w3schools.com/html/html_media.asp
Rubrics 1 2 3 Total
Marks
42
220280116008 Batva Pooja
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
43
220280116008 Batva Pooja
<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.
Frame.html Nav.html
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, <title>Navigation Frame</title>
initial-scale=1.0"> </head>
<title>Web Page with Frameset</title> <body>
</head> <h3>Navigation</h3>
<frameset cols="20%, 80%"> <ul>
<li><a href="naruto.html"
<frame name="nav" src="nav_frame.html"> target="content">Naruto</a></li>
<frame name="content" src="content_frame.html"> <li><a href="jjk.html" target="content">JJK</a></li>
<li><a href="yourname.html" target="content">Your
<noframes> Name</a></li>
<body>Your browser does not support </ul>
frames.</body> </body>
</noframes> </html>
</frameset>
</html>
Content_frame.html Style.css
<!DOCTYPE html> body {
<html lang="en"> font-family: Arial, sans-serif;
<head> margin: 0;
<meta charset="UTF-8"> padding: 0;
<title>Content Frame</title> background-color: #f4f4f4;
</head> }
<body> header {
<h1>Welcome to the Content Area</h1> background-color: #FF6600;
<p>Click on the links in the navigation frame to load color: white;
new content here.</p> text-align: center;
44
220280116008 Batva Pooja
45
220280116008 Batva Pooja
Output:
The frame-based layout allows for a simple division of a web page into navigation and content
sections, providing a way to manage content display dynamically. However, for modern web design,
it's recommended to use CSS-based layouts for better flexibility and compatibility.
Quiz:
3. Which attribute in frame tag is used to specifies the web page to load into that frame?
The src attribute in the <frame> tag specifies the web page to load into that frame.
46
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/tags/tag_frameset.asp
Rubrics 1 2 3 Total
Marks
47
220280116008 Batva Pooja
Experiment No: 8
Date:
Relevant CO: 3
Objectives:
Theory:
Introduction To CSS
48
220280116008 Batva Pooja
Example:In this example all <p> elements will be center-aligned, with a red text color
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;
}
49
220280116008 Batva Pooja
o Example
<!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.
50
220280116008 Batva Pooja
o Example
-
<!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}
51
220280116008 Batva Pooja
o o
- 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>
52
220280116008 Batva Pooja
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">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Junagadh, Gujarat</title>
<style>
/* General Styling */
body {
font-family: 'Arial', sans-serif;
background-color: #e0f7fa; /* Light blue background */
color: #333;
margin: 0;
padding: 0;
line-height: 1.6;
}
/* Header Section */
header {
53
220280116008 Batva Pooja
header h1 {
font-size: 48px;
font-family: 'Georgia', serif;
margin: 0;
}
header p {
font-size: 22px;
margin: 10px 0;
font-style: italic;
}
/* Navigation Bar */
nav {
background-color: #333;
padding: 15px 0;
text-align: center;
}
nav a {
color: white;
text-decoration: none;
font-size: 18px;
margin: 0 15px;
padding: 10px 20px;
display: inline-block;
border-radius: 5px;
}
nav a:hover {
background-color: #1565c0;
}
/* Image Section */
.image {
text-align: center;
margin: 40px 0;
}
.image img {
width: 100%;
border-radius: 15px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}
/* Content Section */
section {
padding: 40px 20px;
background-color: white;
border-radius: 10px;
margin: 20px 0;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
section h2 {
color: #1565c0;
54
220280116008 Batva Pooja
font-size: 36px;
margin-bottom: 20px;
}
section p {
font-size: 18px;
margin: 15px 0;
}
#food {
background-color: #d7eefb; /* Soft blue */
}
/* Footer */
footer {
background-color: #333;
color: white;
padding: 20px;
text-align: center;
}
/* Scroll-to-Top Button */
.scroll-top-btn {
position: fixed;
bottom: 30px;
right: 30px;
background-color: #1565c0;
color: white;
border: none;
padding: 10px 20px;
font-size: 18px;
border-radius: 50px;
cursor: pointer;
display: none;
}
.scroll-top-btn:hover {
background-color: #1e88e5;
}
section h2 {
font-size: 28px;
}
}
</style>
</head>
<body>
55
220280116008 Batva Pooja
56
220280116008 Batva Pooja
<section id="food">
<h2>Famous Foods of Junagadh</h2>
<p>Junagadh’s cuisine is a delightful blend of traditional Gujarati flavors. Some of the must-try dishes include
Khaman, Dhokla, Thepla, and the delicious Gujarati Thali. Street food in Junagadh, such as Fafda and Jalebi, is also
popular among both locals and tourists.</p>
<p>For those with a sweet tooth, don’t miss the local specialty, Ghee Sweets, made with pure ghee and known for
their rich taste and aroma.</p>
</section>
</div>
Scroll-to-Top Button
<button class="scroll-top-btn" onclick="scrollToTop()">⇧ Back to Top</button>
<script>
// Show Scroll to Top Button when scrolled
window.onscroll = function() {
var button = document.querySelector('.scroll-top-btn');
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
button.style.display = "block";
} else {
button.style.display = "none";
}
};
</body>
</html>
Output:
57
220280116008 Batva Pooja
58
220280116008 Batva Pooja
Conclusion:
The web page uses internal CSS to create an appealing design with a light green background,
contrasting text color, and a responsive image. This approach ensures that the page is visually
engaging and easy to read.
Quiz:
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: Google
Rubrics 1 2 3 Total
Marks
59
220280116008 Batva Pooja
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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resume</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; margin: 0; padding: 0;">
<div class="body" style="width: 50rem; margin: auto;">
<header style="display: flex; flex-direction: column; align-items: center; background-color: rgb(0, 0, 70);">
<h1 style="color: white; padding: 0; margin: 5px;"> POOJA BATVA</h1>
<p style="color: white; padding: 0; margin: 5px;">SOFTWARE ENGINEER</p>
</header>
<section style="display: flex;">
<section class="left" style="background-color: aliceblue; width: 100rem;">
<section class="contact">
<h3 style="color: navy;">CONTACT</h3>
<label for="phoneno">Phone No :</label>
<a href="93XXX XXXXX">93XXX XXXXX</a><br>
60
220280116008 Batva Pooja
61
220280116008 Batva Pooja
scheduled for June 26-27, 2024 in Chennai, India. Participants are encouraged to propose innovative solutions, either
based on provided data or their own ideas, focusing on sustainability and social impact.</p>
</section>
</section>
</section>
</div>
</body>
</html>
Output:
Conclusion:
Inline CSS styles elements directly within the HTML tags, allowing for immediate and specific
customization. This approach is useful for quick adjustments but can lead to less maintainable code
compared to external or internal CSS.
62
220280116008 Batva Pooja
Quiz:
https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
Rubrics 1 2 3 Total
Marks
63
220280116008 Batva Pooja
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>
64
220280116008 Batva Pooja
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
65
220280116008 Batva Pooja
body {
font-family: 'Arial', sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
nav ul {
list-style: none;
padding: 0;
}
nav ul li {
display: inline-block;
margin: 0 15px;
}
nav ul li a {
color: white;
text-decoration: none;
font-weight: bold;
}
section {
padding: 20px;
margin: 20px auto;
background-color: #ffffff;
width: 80%;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
Output:
66
220280116008 Batva Pooja
Conclusion:
Using external CSS consistent styling is maintained across multiple pages, internal CSS is useful for
document-specific styles, and inline CSS allows for quick, localized adjustments. This approach
enhances flexibility and maintains clarity in styling web pages.
Quiz:
Suggested Reference:
https://www.geeksforgeeks.org/types-of-css-cascading-style-sheet/
Rubrics 1 2 3 Total
Marks
67
220280116008 Batva Pooja
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).
68
220280116008 Batva Pooja
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">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Date</title>
</head>
<body>
<script>
console.log(new Date());
</script>
</body>
</html>
Output :
Conclusion:
This practical implementation of JavaScript effectively demonstrates how to display today’s date on a web
page. The program uses the built-in Date object to fetch and format the current date,
69
220280116008 Batva Pooja
Quiz:
1. What is javascript?
JavaScript is a programming language that adds interactivity to web pages. It's used to create
dynamic and interactive web pages
https://www.w3schools.com/JSREF/jsref_obj_date.asp
References used by the students: Google
Rubrics 1 2 3 Total
Marks
70
220280116008 Batva Pooja
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
71
220280116008 Batva Pooja
DOM Examples
<html>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script>
</body>
</html>
72
220280116008 Batva Pooja
<!DOCTYPE html>
<html>
<body>
<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.
Calc.html
<!DOCTYPE html> <input type="button" value="7" class="btn" />
<html lang="en"> <input type="button" value="8" class="btn" />
<head> <input type="button" value="9" class="btn" />
<meta charset="UTF-8" /> <input type="button" value="*" class="btn" />
<meta name="viewport" content="width=device-width, <input type="button" value="4" class="btn" />
initial-scale=1.0" /> <input type="button" value="5" class="btn" />
<title>Calculator</title> <input type="button" value="6" class="btn" />
<link rel="stylesheet" href="Calc.css" /> <input type="button" value="-" class="btn" />
</head> <input type="button" value="1" class="btn" />
<body> <input type="button" value="2" class="btn" />
<div class="body"> <input type="button" value="3" class="btn" />
<div class="input"> <input type="button" value="+" class="btn" />
<input type="texta" name="" id="display" /> <input type="button" value="00" class="btn" />
</div> <input type="button" value="0" class="btn" />
<div class="buttons"> <input type="button" value="=" id="eql" />
<input type="button" value="AC" id="allclear" /> </div>
<input type="button" value="DE" id="backspace" /> </div>
<input type="button" value="." class="btn" /> <script src="Calc.js"></script>
<input type="button" value="/" class="btn" /> </body></html>
73
220280116008 Batva Pooja
Calc.css Calc.js
.body{
width: 15.5rem; let display = document.getElementById('display');
border: 2px solid gray; let btn = document.querySelectorAll('.btn');
margin: auto;
} for (let i = 0; i < btn.length; i++) {
btn[i].addEventListener("click",function(){
.input input{ display.value += btn[i].value;
height: 3rem; });
width: 15rem; }
text-align: right;
font-size: 20px; let equals = document.querySelector('#eql');
} let allc = document.querySelector('#allclear');
let back = document.querySelector('#backspace');
.buttons{
display: flex; equals.addEventListener('click', function(){
flex-wrap: wrap; display.value = eval(display.value);
width: 15rem; });
}
allc.addEventListener('click', function(){
.buttons input{ display.value = "";
width: 3rem; });
height: 3rem;
margin: 0.7rem 0 0 0.7rem; back.addEventListener('click',function(){
} display.value = display.value.slice(0,-1);
});
.buttons #eql{
width: 6.7rem; document.addEventListener('keydown' , function(event){
} let key = event.key;
if(key == 'Enter'){
display.value = eval(display.value);
}
})
Output :
74
220280116008 Batva Pooja
Conclusion:
This implementation demonstrates how to create a simple calculator using JavaScript that can perform
addition, subtraction, multiplication, and division. The integration of HTML, CSS, and JavaScript creates an
interactive user experience, while the straightforward design ensures usability. This project showcases
fundamental programming concepts in JavaScript, such as functions, event handling, and conditional logic,
making it a practical exercise for beginners in web development.
Quiz:
https://www.w3schools.com/js/js_htmldom.asp
https://www.w3schools.com/js/js_validation.asp
References used by the students: Google
Rubrics 1 2 3 Total
Marks
75
220280116008 Batva Pooja
Experiment No: 13
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()
76
220280116008 Batva Pooja
<!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.
Form.js
let submitButton = document.getElementById("submit");
let outputText = `
Full Name: ${fullName}
Email: ${email}
Mobile No: ${mobileNo}
Date of Birth: ${dob}
Gender: ${gender}
Education: ${education}
Address: ${address}
State: ${state}
77
220280116008 Batva Pooja
`;
alert(outputText);
});
Output :
Conclusion:
This implementation provides a simple registration page where users can enter their information and view it
combined in a friendly format upon clicking the button. The project showcases fundamental concepts of web
development, including HTML structure, CSS for styling, and JavaScript for dynamic interactivity. This
example is an excellent starting point for beginners to understand how to manipulate the Document Object
Model (DOM) and respond to user actions effectively.
Quiz:
Event Listeners: An event listener is a function that waits for a specific event to occur on a
particular element. When the event occurs, the listener executes its associated function.
78
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/js/js_validation.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
79
220280116008 Batva Pooja
Experiment No: 14
Date:
Relevant CO: 4
Objectives:
<h2>JavaScript Validation</h2>
</body>
</html>
80
220280116008 Batva Pooja
Implementation:
submitButton.addEventListener("click", function(event) {
event.preventDefault();
if(!numvalidation.test(mobileNo)){
errormsg += "Mobile number must be 10 digits.\n";
}
if(errormsg != ""){
alert(errormsg);
} else {
alert("Registration Successful!");
}
});
81
220280116008 Batva Pooja
Output :
Conclusion:
this JavaScript validation implementation is crucial for creating robust and user-friendly web applications. It
not only streamlines the registration process but also enhances the overall reliability and security of the
application by reducing the chances of receiving invalid data. This foundational knowledge of form
validation is essential for any aspiring web developer, providing a basis for building more complex user
interfaces in the future.
Quiz:
82
220280116008 Batva Pooja
Data Integrity: Ensure that the data submitted is accurate and conforms to expected formats
(e.g., email addresses, phone numbers).
User Experience: Provide real-time feedback to users, helping them correct errors before
submission.
Reduce Server Load: By validating on the client side, you can prevent unnecessary server
requests for invalid data.
Types of Validation:
Client-Side Validation: Performed in the user's browser using JavaScript before the form data
is sent to the server. It is fast and provides instant feedback.
Server-Side Validation: Performed on the server after the form is submitted. This is essential
to ensure security and handle cases where JavaScript might be disabled in the
browser.
Common Validation Techniques:
Required Fields: Check if certain fields must be filled out (e.g., name, email).
Format Checking: Validate that the data follows a specific format (e.g., email format, phone
number format).
Length Checking: Ensure that text inputs meet minimum and/or maximum length
requirements.
Value Range Checking: For numeric inputs, validate that the values fall within a specified
range.
Using Regular Expressions: Regular expressions (regex) are often used in validation
to define complex patterns for strings. For example, you can use regex to validate
email formats or password complexity.
Suggested Reference:
https://www.w3schools.com/js/js_validation.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
83
220280116008 Batva Pooja
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
?>
Example :demonstrate printing Hello World
<!DOCTYPE html>
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>
Statement Syntax
84
220280116008 Batva Pooja
Statement Syntax
85
220280116008 Batva Pooja
Implementation:
<?php
function isPrime($n){
if($n <= 1){
return false;
}
for($i = 2; $i <= sqrt($n); $i++){
if($n % $i == 0){
return false;
}
}
return true;
}
$n = 67;
if(isPrime($n)){
echo"{$n} is prime number";
}
else{
echo"{$n} is NOT prime number";
}
?>
Output :
Conclusion:
The PHP program to check if a number is prime effectively demonstrates the use of basic programming
constructs such as conditional statements and loops. By employing an efficient algorithm that only tests for
factors up to the square root of the number, the program optimizes performance, especially for larger inputs.
Quiz:
86
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/php/php_looping.asp
Rubrics 1 2 3 Total
Marks
87
220280116008 Batva Pooja
Experiment No: 16
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.
88
220280116008 Batva Pooja
You will need to replace the variables $mysql_host, $mysql_user, $mysql_password and
$mysql_db with strings containing the values for connecting to your database. $mysql_host
is "localhost"
echo "\t\n";
echo "\n";
// free result
mysql_free_result( $result );
89
220280116008 Batva Pooja
- 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.
90
220280116008 Batva Pooja
91
220280116008 Batva Pooja
92
220280116008 Batva Pooja
echo "Error updating record: " . $conn->error; value="M.Tech" <?php echo in_array('M.Tech', explode(', ',
} $user['education'])) ? 'checked' : ''; ?>>M.Tech<br />
} <input type="checkbox" name="education[]"
value="Ph.D" <?php echo in_array('Ph.D', explode(', ',
$conn->close(); $user['education'])) ? 'checked' : ''; ?>>Ph.D<br />
?> </div>
<div>
<label for="address">Address:</label>
<textarea name="address" required><?php echo
$user['address']; ?></textarea>
</div>
<div>
<label for="state">State:</label>
<select name="state">
<option value="Gujarat" <?php echo $user['state']
=== 'Gujarat' ? 'selected' : ''; ?>>Gujarat</option>
<!-- Add other states similarly -->
</select>
</div>
<div>
<input type="submit" value="Update" />
</div>
</form>
</body>
</html>
<?php
$conn->close();
?>
Output :
93
220280116008 Batva Pooja
Conclusion:
This practical showcases a complete user registration system using PHP and MySQL, providing a hands-on
experience with several important concepts in web development : User Registration , Data Retrieval and
Display, Update and Delete Features , Error Handling.
Quiz:
1. What is MySql?
MySQL is an open-source relational database management system (RDBMS) that is
widely used for managing and organizing data. It is one of the most popular database
systems in the world and is known for its speed, reliability, and flexibility.
2. Write a sample code to demonstrate php mysql connectivity.
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
94
220280116008 Batva Pooja
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
Suggested Reference:
http://www.php.net/manual/en/ref.mysql.php
References used by the students:
Rubrics 1 2 3 Total
Marks
95
220280116008 Batva Pooja
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:
96
220280116008 Batva Pooja
<?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:
97
220280116008 Batva Pooja
<?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():
98
220280116008 Batva Pooja
<?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.
99
220280116008 Batva Pooja
if ($_SERVER["REQUEST_METHOD"] == "POST") { }
$username = $_POST['username']; }
$password = $_POST['password'];
$conn->close();
$sql = "SELECT * FROM users WHERE ?>
username='$username'";
$result = $conn->query($sql); <!DOCTYPE html>
<html lang="en">
if ($result->num_rows > 0) { <head>
$row = $result->fetch_assoc(); <meta charset="UTF-8">
// Verify password <meta name="viewport" content="width=device-width,
if (password_verify($password, $row['password'])) { initial-scale=1.0">
$_SESSION['username'] = $username; // Store <title>Register</title>
username in session </head>
header("Location: welcome.php"); // Redirect to <body>
welcome page <h1>Registration</h1>
exit(); <form action="" method="POST">
} else { <div>
echo "Invalid password."; <label for="username">Username:</label>
} <input type="text" name="username" required>
} else { </div>
echo "No user found with that username."; <div>
} <label for="password">Password:</label>
} <input type="password" name="password"
required>
$conn->close(); </div>
?> <div>
<input type="submit" value="Register">
<!DOCTYPE html> </div>
<html lang="en"> </form>
<head> </body>
<meta charset="UTF-8"> </html>
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Login</title>
Welcome.php
</head>
<body>
<?php
<h1>Login</h1>
session_start(); // Start the session
<form action="" method="POST">
<div>
if (!isset($_SESSION['username'])) {
<label for="username">Username:</label>
header("Location: login.php"); // Redirect to login if not
<input type="text" name="username" required>
logged in
</div>
exit();
<div>
}
<label for="password">Password:</label>
<input type="password" name="password"
// Logout logic
required>
if (isset($_GET['logout'])) {
</div>
session_destroy(); // Destroy the session
<div>
header("Location: login.php"); // Redirect to login page
<input type="submit" value="Login">
exit();
</div>
}
</form>
?>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Welcome</title>
</head>
100
220280116008 Batva Pooja
<body>
<h1>Welcome, <?php echo
htmlspecialchars($_SESSION['username']); ?>!</h1>
<p><a href="?logout=true">Logout</a></p>
</body>
</html>
Output :
Conclusion:
This practical illustrates a complete user authentication system using PHP and MySQL, providing a hands-on
experience with several fundamental concepts in web development: User Registration, User Login, Session
Management, Error Handling.
Quiz:
A PHP session can be destroyed by session_destroy() function. This function does not
need any argument and a single call can destroy all the session variables. If you want
to destroy a single session variable then you can use unset() function to unset a
session variable.
101
220280116008 Batva Pooja
<?php
unset($_SESSION['counter']);
?>
Here is the call which will destroy all the session variables −
<?php
session_destroy();
?>
Suggested Reference:
https://www.w3schools.com/php/php_sessions.asp
References used by the students:
Rubrics 1 2 3 Total
Marks
102
220280116008 Batva Pooja
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
103
220280116008 Batva Pooja
xhttp.onload = function() {
// What to do when the response is ready
}
xhttp.open("GET", "ajax_info.txt");
xhttp.send();
Method Description
104
220280116008 Batva Pooja
Property Description
105
220280116008 Batva Pooja
xhttp.onload = function() {
document.getElementById("demo").innerHTML = this.responseText;
}
xhttp.open("GET", "ajax_info.txt");
xhttp.send();
106
220280116008 Batva Pooja
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.
107
220280116008 Batva Pooja
<?php
header('Content-Type: application/json');
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registration_db";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Close connection
mysqli_close($conn);
?>
Output :
108
220280116008 Batva Pooja
Conclusion:
This practical demonstrates a visual search feature implemented using AJAX, which effectively enhances user
interaction and experience in web applications like Dynamic Search, Data Retrieval, User Interface, Security
Measures.
Quiz:
1. What is Ajax?
AJAX is a developer's dream, because you can:
Read data from a web server - after a web page has loaded
Update a web page without reloading the page
Send data to a web server - in the background
2. Explain XMLHttpRequest.
XMLHttpRequest (XHR) is a JavaScript object that allows developers to interact
with servers asynchronously. It is primarily used to send and receive data from a
web server without requiring a page reload. This capability is fundamental to
modern web applications, enabling dynamic content updates and improving user
experience.
Key Features of XMLHttpRequest
Asynchronous Communication: XMLHttpRequest allows for asynchronous
requests, meaning that the user can continue interacting with the webpage
while data is being fetched or sent in the background.
Support for Various Data Formats: While it was originally designed to work with
XML, XMLHttpRequest can also handle other data formats, such as JSON,
HTML, and plain text. This flexibility makes it suitable for various
applications.
109
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/xml/ajax_intro.asp
Rubrics 1 2 3 Total
Marks
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
110
220280116008 Batva Pooja
JSON format is the most common output format of REST API, we will use the JSON format to
consume our simple REST API. We will developed an online transaction payment REST API
for our example. I will try to keep it as simple as possible so i will use GET request to
retrieve information.
1. Create REST API in PHP
2. Consume REST API in PHP
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.
111
220280116008 Batva Pooja
<?php
header("Content-Type:application/json");
if (isset($_GET['order_id']) && $_GET['order_id']!="") {
include('db.php');
$order_id = $_GET['order_id'];
$result = mysqli_query(
$con,
"SELECT * FROM `transactions` WHERE order_id=$order_id");
if(mysqli_num_rows($result)>0){
$row = mysqli_fetch_array($result);
$amount = $row['amount'];
$response_code = $row['response_code'];
$response_desc = $row['response_desc'];
response($order_id, $amount, $response_code,$response_desc);
mysqli_close($con);
}else{
response(NULL, NULL, 200,"No Record Found");
}
}else{
response(NULL, NULL, 400,"Invalid Request");
}
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
112
220280116008 Batva Pooja
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:
113
220280116008 Batva Pooja
db.sql dbConn.php
Index.php Api.php
114
220280116008 Batva Pooja
>amount}</td></tr>"; Failed");
echo "<tr><td>Response Code:</td><td>{$result- }
>response_code}</td></tr>";
echo "<tr><td>Response Desc:</td><td>{$result- mysqli_close($con); // Close the connection
>response_desc}</td></tr>"; } else {
echo "</table>"; response(NULL, NULL, 400, "Invalid Request");
} else { }
echo "<p>No valid response from the
server.</p>"; // Response function to return JSON response
} function response($order_id, $amount, $response_code,
} $response_desc) {
?> $response = array(
</body> 'order_id' => $order_id,
</html> 'amount' => $amount,
'response_code' => $response_code,
'response_desc' => $response_desc
);
echo json_encode($response);
}
?>
Output :
Conclusion:
This practical demonstrates the creation of a REST API using PHP and MySQL, providing a foundational
understanding of web service development. Like RESTful Architecture, Data Management, JSON
Responses , Error Handling .
Quiz:
https://www.allphptricks.com/create-and-consume-simple-rest-api-in-php/)
115
220280116008 Batva Pooja
Rubrics 1 2 3 Total
Marks
116
220280116008 Batva Pooja
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()
117
220280116008 Batva Pooja
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:
118
220280116008 Batva Pooja
$("#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()
119
220280116008 Batva Pooja
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:
120
220280116008 Batva Pooja
.slider{ }else{
width: 100%; idx = length -1 ;
height: 100%; }
display: flex; $('.slider').css({
transition: 0.5s ease; transform : `translateX(-${idx*100}%)`,
} transition : 'transform 0.5s ease'
.slider img{ })
width: 100%; })
height: 100%; })
}
</style>
</head>
<body>
<div class="body">
<button class="left"><</button>
<div class="container">
<div class="slider">
<img src="gojo.jpg" alt="gojo">
<img src="Gojo2.jpg" alt="gojo">
<img src="Sasuke.jpg" alt="sasuke">
</div>
</div>
<button class="right">></button>
</div>
<script src="js/jquery-3.7.1.min.js"></script>
<script src="slider.js"></script>
</body>
</html>
Output :
Conclusion:
This practical demonstrates the creation of a simple image slider using jQuery, providing a hands-on
121
220280116008 Batva Pooja
experience with several important web development concepts: Dynamic Content, jQuery Integration,
Responsive Design, User Interaction.
Quiz:
1. What is jquery?
jQuery is a lightweight, "write less, do more", JavaScript library.
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:
HTML/DOM manipulation
CSS manipulation
HTML event methods
Effects and animations
AJAX
Utilities
The user only need to write the required jQuery code The user needs to write the complete js code
There is no requirement for handling multi-browser compatibility Developers develop their own code for handling multi-browser
issues. compatibility.
It is required to include the URL of the jQuery library in the JavaScript is supportable on every browser. Any additional
header of the page. plugin need not to be included.
It contains only a few lines of code. The code can be complicated, as well as long.
It is quite an easy, simple, and fast approach. It is a weakly typed programming approach.
122
220280116008 Batva Pooja
Suggested Reference:
https://www.w3schools.com/jquery/jquery_intro.asp
Rubrics 1 2 3 Total
Marks
123
220280116008 Batva Pooja
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:
<?php
if (isset($_POST['color'])) {
$color = $_POST['color'];
setcookie('bgcolor', $color, time() + (86400 * 30), "/");
} else if (isset($_COOKIE['bgcolor'])) {
$color = $_COOKIE['bgcolor'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Save Background Color</title>
</head>
<body style="background-color: <?php echo isset($color) ? $color : '#ffffff'; ?>;">
</body>
</html>
124
220280116008 Batva Pooja
Conclusion:
This practical demonstrates how to create a simple web application that utilizes cookies for persistent data
storage, enhancing user experience by remembering user preferences. Persistent User Preferences , Basic
JavaScript Functions, User Interaction, Dynamic Page Behavior.
Quiz:
1. What is cookie?
A cookie is a small piece of data that is stored on a user's computer by a web browser
while browsing a website. Cookies are used to remember information about the user,
such as login credentials, preferences, and other data that enhances the user experience.
They play a crucial role in web development and are essential for maintaining state and
managing user sessions.
2. What is the life of cookie?
Cookies can last on a user's browser till the time it is set to expire and typically last
from seconds to years. The cookie expiration or cookie duration is either set by the
website publisher or domains that drop the cookies.
https://www.w3schools.com
Rubrics 1 2 3 Total
Marks
125