Experiment-2: AIM: To Use Anchor Tag and Hyperlink Different Pages. Theory
Experiment-2: AIM: To Use Anchor Tag and Hyperlink Different Pages. Theory
Experiment-2: AIM: To Use Anchor Tag and Hyperlink Different Pages. Theory
Experiment-2
Code:
CGC.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CGC</title>
</head>
<body>
<center><h1>WELCOME TO CGC</h1></center>
<img src="https://getmyuni.azureedge.net/college-image/big/chandigarh-group-of-colleges-
cgc-landran-mohali.jpg" width="100%" height="300px">
<center>
<h2>
<a href="cec/index.html">CEC</a>
<a href="coe/index.html">COE</a>
<a href="cbsa/index.html">CBSA</a>
</h2>
</center>
<h2>ABOUT US</h2>
<p>Chandigarh Group of Colleges, Landran has become a synonym to excellence. Situated
Department of Information Technology
on the National Highway 205A, Chandigarh Group of Colleges bespeaks A-class educational
facilities. CGC, Landran has come a long way in the field of education. In the year 2001, it got
incepted with a hope to bridge the gap between inquisitive minds and education.
Initially, Engineering was the flagship program at CGC, Landran and with time, more & more
programs got added to the curriculum. Currently, the college offers 45+ programs under seven
domains namely Engineering, Biotechnology, Computer Application, Management, Education,
Pharmacy, and Hotel Management. Under the aegis of CGC, Landran, new-wave pedagogy, 360-
Degree training, international exposure, and industry-academia interface have been methodically
interwoven, to provide a comprehensive overlook of the respective industries. With the provision of
remarkable infrastructure, ultra-modern laboratories, accompanied by practical strategies, the
college has managed to reform the ways of modern education.</p>
</body>
</html>
CEC/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CEC</title>
</head>
<body>
<center><h1>CEC</h1></center>
<img src="https://getmyuni.azureedge.net/college-image/big/chandigarh-group-of-colleges-
cgc-landran-mohali.jpg" width="100%" height="300px">
<center>
<h2>
<a href="it/index.html">IT</a>
<a href="cse/index.html">CSE</a>
</h2>
</center>
<center><h2>ABOUT CEC</h2></center>
<p>Chandigarh Group of Colleges, Landran has become a synonym to excellence. Situated
on the National Highway 205A, Chandigarh Group of Colleges bespeaks A-class
educational facilities. CGC, Landran has come a long way in the field of education. In the
year 2001, it got incepted with a hope to bridge the gap between inquisitive minds and
education.
</p>
</body>
</html>
COE/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Department of Information Technology
<title>COE</title>
</head>
<body>
<center><h1>COE</h1></center>
<img src="https://getmyuni.azureedge.net/college-image/big/chandigarh-group-of-colleges-
cgc-landran-mohali.jpg" width="100%" height="300px">
<center><h2>ABOUT COE</h2></center>
<p>Chandigarh Group of Colleges, Landran has become a synonym to excellence. Situated
on the National Highway 205A, Chandigarh Group of Colleges bespeaks A-class
educational facilities. CGC, Landran has come a long way in the field of education. In the
year 2001, it got incepted with a hope to bridge the gap between inquisitive minds and
education.
</p>
</body>
</html>
CBSA/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CBSA</title>
</head>
<body>
<center><h1>CBSA</h1></center>
<img src="https://getmyuni.azureedge.net/college-image/big/chandigarh-group-of-colleges-
cgc-landran-mohali.jpg" width="100%" height="300px">
<center><h2>ABOUT CBSA</h2></center>
<p>Chandigarh Group of Colleges, Landran has become a synonym to excellence. Situated
on the National Highway 205A, Chandigarh Group of Colleges bespeaks A-class
educational facilities. CGC, Landran has come a long way in the field of education. In the
year 2001, it got incepted with a hope to bridge the gap between inquisitive minds and
education.
</p>
</body>
</html>
SCREENSHOTS:
Department of Information Technology
Department of Information Technology
Department of Information Technology
Experiment-3
2. Unordered List HTML: Unordered List or Bulleted List displays elements in bulleted format
. We can use unordered list where we do not need to display items in any particular order.
The HTML ul tag is used for the unordered list.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
Department of Information Technology
<ol type="1">
<li>
CHAPTER 1
<ul type="disc">
<li>Sub topic 1</li>
<li>Sub topic 2</li>
<li>Sub topic 3</li>
</ul>
</li>
<li>
CHAPTER 2
<ul type="disc">
<li>Sub topic 1</li>
<li>Sub topic 2</li>
<li>Sub topic 3</li>
</ul>
</li>
<li>
CHAPTER 3
<ul type="disc">
<li>Sub topic 1</li>
<li>Sub topic 2</li>
<li>Sub topic 3</li>
</ul>
</li>
</ol>
</body>
</html>
OUTPUT:
Department of Information Technology
Experiment-4
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Department of Information Technology
<h2>
<b>This text is Bold</b><br>
<i>This text is Italic</i><br>
<u>This text is Underline</u><br>
<font color="red" size="20px" family="Times New Roman">This text is using font
tag with color = red and size = 20px</font>
</h2>
</body>
</html>
OUTPUT:-
Department of Information Technology
Experiment-5
Aim: Develop an HTML page including CSS to create table by using row andcol span.
THEORY: - The rowspan and colspan are <td> tag attributes. These are used to specify the number
of rows or columns a cell should span. The rowspan attribute is for rows as well as the colspan
attribute is for columns.
These attributes have numeric values, for example, colspan=3 will span three columns. You can use
rowspan="n" on a td element to make it span n rows, and colspan="m" on a td element to make it
span mcolumns.
CODE:
<!DOCTYPE html>
<html>
<head>
<title>Jatin Bajaj 2102497</title>
<style>
table,td,th{
border:1px solid black; border-collapse: collapse; text-align: center;
}
</style>
</head>
<body>
<table>
<tr>
<th colspan="6">DEPARTMENT OF INFORMATION
Jatin Bajaj 2102497
DEPARTMENT OF INFORMATION TECHNOLOGY
TECHNOLOGY
Department of Information Technology
</th>
</tr>
<tr >
<th colspan="6">IT 6th Semester</th>
</tr>
<tr>
<th>S. No.</th>
<th>Roll No.</th>
<th>Name</th>
<th>Lecture attended</th>
<th>Attendance</th>
<th>Overall Percent</th>
</tr>
<tr>
<td>1.</td>
<td>101</td>
<td>Aditi</td>
<td>3</td>
<td>100%</td>
<td rowspan="6">80%</td>
</tr>
<tr>
<td>2.</td>
<td>102</td>
<td>Aakash</td>
<td>2</td>
<td>75%</td>
</tr>
<tr>
<td>3.</td>
<td>103</td>
<td>Devansh</td>
<td>1</td>
<td>50%</td>
</tr>
<tr>
<td>4.</td>
<td>104</td>
<td>Jatin</td>
<td>3</td>
<td>100%</td>
</tr>
<tr>
<td>5.</td>
Jatin Bajaj 2102497
DEPARTMENT OF INFORMATION TECHNOLOGY
<td>105</td>
<td>Divansh</td>
<td>3</td>
<td>100%</td>
</tr>
<tr>
Department of Information Technology
<td>6.</td>
<td>106</td>
<td>Harshit</td>
<td>1</td>
<td>30%</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
Department of Information Technology
Experiment-6
THEORY: - An internal link is a link from one page to another page on the same domain.
They're simply text hyperlinks from one page to another page on your website.
Internal linking is important for at least three reasons. They strengthen three parts of
your funnel.
CODE:
<!DOCTYPE html>
<html>
<head>
<title>Jatin Bajaj 2102497</title>
</head>
<body>
<h1><a id="top">INDEX</a></h1>
<a href="#C1">Chapter 1</a><br>
<a href="#C2">Chapter 2</a><br>
<a href="#C3">Chapter 3</a><br>
<a href="#C4">Chapter 4</a><br>
<a href="#C5">Chapter 5</a><br>
<h3 id ="C1">Chapter 1</h3>
<p>A book is a medium for recording information in the form of writing or images, typically
composed of many pages (made of papyrus, parchment, vellum, or paper) bound together and
protected by a cover. The technical term for this physical arrangement is codex (plural, codices). In
the history of hand-held physical supports for extended written compositions or records, the codex
replaces its predecessor, the scroll. A single sheet in a codex is a leaf and each side of a leaf is a
page.</p>
Jatin Bajaj 2102497
DEPARTMENT OF INFORMATION TECHNOLOGY
<a href="#top">Go back to top</a><br>
<h3 id ="C2">Chapter 2</h3>
<p>A book is a medium for recording information in the form of writing or images, typically
composed of many pages (made of papyrus, parchment, vellum, or paper bound together and
Department of Information Technology
protected by a cover. The technical term for this physical arrangement is codex (plural, codices). In
the history of hand-held physical supports for extended written compositions or records, the codex
replaces its predecessor, the scroll. A single sheet in a codex is a leaf and each side of a leaf is a
page.</p>
<a href="#top">Go back to top</a><br>
<h3 id ="C3">Chapter 3</h3>
<p>A book is a medium for recording information in the form of writing or images, typically
composed of many pages (made of papyrus, parchment, vellum, or paper) bound together and
protected by a cover. The technical term for this physical arrangement is codex (plural, codices). In
the history of hand-held physical supports for extended written compositions or records, the codex
replaces its predecessor, the scroll. A single sheet in a codex is a leaf and each side of a leaf is a
page.</p>
<a href="#top">Go back to top</a><br>
<h3 id ="C4">Chapter 4</h3>
<p>A book is a medium for recording information in the form of writing or images, typically
composed of many pages (made of papyrus, parchment, vellum, or paper) bound together and
protected by a cover. The technical term for this physical arrangement is codex (plural, codices). In
the history of hand-held physical supports for extended written compositions or records, the codex
replaces its predecessor, the scroll. A single sheet in a codex is a leaf and each side of a leaf is a
page.</p>
<a href="#top">Go back to top</a><br>
<h3 id ="C5">Chapter 5</h3>
<p>A book is a medium for recording information in the form of writing or images, typically
composed of many pages (made of papyrus, parchment, vellum, or paper) bound together and
protected by a cover. The technical term for this physical arrangement is codex (plural, codices). In
the history of hand-held physical supports for extended written compositions or records, the codex
replaces its predecessor, the scroll. A single sheet in a codex is a leaf and each side of a leaf is a
page.</p>
<a href="#top">Go back to top</a><br>
</body>
</html>
OUTPUT:-
Department of Information Technology
Experiment-7
CODE:
frameset.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<frameset rows="*,*">
<frameset cols="*,*">
<frame src="cgc.html">
<frame src="map.html">
</frameset>
<frameset cols="*,*">
Department of Information Technology
<frame src="about.html">
<frame src="cgclogo.html">
</frameset>
</frameset>
</html>
cgc.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body>
<center>
<h1>Welcome to CGC</h1>
<img src="https://getmyuni.azureedge.net/college-image/big/chandigarh-group-of-
colleges-cgc-landran-mohali.jpg">
</center>
</body>
</html>
about.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body>
<center>
<h1>ABOUT CGC</h1>
Department of Information Technology
map.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body>
<center>
<h1>CGC MAP</h1>
<div class="mapouter"><div class="gmap_canvas"><iframe width="600"
height="500" id="gmap_canvas" src="https://maps.google.com/maps?q=Cgc
%20Landran&t=&z=13&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no"
marginheight="0" marginwidth="0"></iframe><a
href="https://embedgooglemap.net/124/"></a><br><style>.mapouter{position:relative;text-
align:right;height:500px;width:600px;}</style><a
href="https://www.embedgooglemap.net"></a><style>.gmap_canvas
{overflow:hidden;background:none!important;height:300px;width:600px;}</style></div></div>
</center>
</body>
</html>
cgclogo.html
<!DOCTYPE html>
<html>
<head>
Department of Information Technology
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body>
<center>
<h1>CGC</h1>
<img src="https://www.admissionindia.net/uploads/colleges/104/CGC_logo.jpeg"
height="200px" width="300px">
</center>
</body>
</html>
OUTPUT:-
Department of Information Technology
Experiment-8
THEORY: -
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a
document written in HTML or XML (including XML dialects such as SVG, MathML or
XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on
other media.
Example:
body {
background-color: lightblue;
}
Types:
There are 3 types of CSS which are below:
Inline CSS: Inline CSS is used to style a specific HTML element. Add a style attribute to
each HTML tag without using the selectors.
Internal CSS: The Internal CSS has <style> tag in the <head> section of the HTML
document. This CSS style is an effective way to style single pages.
External CSS: In external CSS, we link the web pages to the external .css file. It is created
by text editor. The CSS is more efficient method for styling a website.
CODE:
home.html
<!DOCTYPE html>
<html>
<head>
<title>2102497 Jatin</title>
<style type="text/css">
.img-logo
{
width: 100px;
height: 100px;
}
Department of Information Technology
.site-brand
{
display: flex;
position: fixed;
width: 100%;
background: rgba(44, 94, 221, 0.3);
}
.site-heading
{
margin: 0px;
margin-top: 20px;
margin-left: 100px;
font-size: 50px;
color: #fff;
}
body
{
margin: 0;
padding: 0;
background: rgba(44, 94, 221, 0.3);
}
.right-content
{
padding-top: 150px;
padding-left: 50px;
}
.right-content h4
{
font-size: 40px;
text-decoration: underline;
/*color: #fff;*/
}
.right-content p
{
font-size: 20px;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 30%;
margin: 1%;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
Department of Information Technology
.container {
padding: 1px 10px;
}
</style>
</head>
<link rel="stylesheet" type="text/css" href="nav.css">
<body>
<div class="wrapper">
<div class="site-brand" style="display: flex;">
<div class="logo" style="width: 25%;">
<img
src="https://www.static-contents.youth4work.com/university/Documents/Colleges/collegeLogo/
20220208160446.png?v=20220208160446" class="img-logo">
</div>
<div class="site-head-div" style="width: 75%;">
<h3 class="site-heading">Chandigarh Group Of Colleges</h3>
</div>
</div>
<div class="content-body" style="display: flex;">
<div id="mySidenav" class="sidenav" style="width: 20%; ">
<a href="#about-us">About Us</a>
<a href="#blog">Blog</a>
<a href="#">Contact</a>
</div>
<div class="right-content" style="width: 80%; ">
<h4 id="about-us">About Us</h4>
<p>
Chandigarh Group of Colleges, Landran has become a
synonym to excellence. Situated on the National Highway 205A, Chandigarh Group of Colleges
bespeaks A-class educational facilities. CGC, Landran has come a long way in the field of
education. In the year 2001, it got incepted with a hope to bridge the gap between inquisitive minds
and education.
<p>25-November-2022</p>
</div>
</div>
<div class="card">
<img
src="https://www.cgc.edu.in/public/uploads/blogs/thumb_front/343ae9ecea44f7bea9ac904d7a72e8
c9.jpg" alt="Avatar" style="width:100%">
<div class="container">
<h3><b>How Does the World View Hospitality Industry
Post Covid?</b></h3>
<p>25-November-2022</p>
</div>
</div>
<div class="card">
<img
src="https://www.cgc.edu.in/public/uploads/blogs/thumb_front/4850ec002f28ba2c8244a591f25274
18.jpg" alt="Avatar" style="width:100%">
<div class="container">
<h3><b>B.Sc. Biotechnology: Is it a Remunerative Career
Choice in 2023?</b></h3>
<p>25-November-2022</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
nav.css
.sidenav {
height: 100vh;
background-color: #111;
overflow-x: hidden;
padding-top: 200px;
}
.sidenav a {
padding: 65px 8px 8px 110px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
.sidenav a:hover {
color: #f1f1f1;
}
Department of Information Technology
OUTPUT:-
Department of Information Technology
Experiment-9
THEORY: -
The ”iframe” tag defines a rectangular region within the document in which the browser can
display a separate document, including scrollbars and borders. An inline frame is used to embed
another document within the current HTML document.
Syntax:
<iframe src="URL" title="description"></iframe
CODE:
Iframe.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body>
<iframe src="welcome.html" width="50%" height="600px"></iframe>
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!
1d13724.475594703914!2d76.6648404!3d30.6869306!3m2!1i1024!2i768!4f13.1!3m3!1m2!
1s0x390fef154b91a85b%3A0x4d8b9df97e986631!2sChandigarh%20Group%20of%20Colleges
%20(CGC)%20-%20Landran!5e0!3m2!1sen!2sin!4v1678336559637!5m2!1sen!2sin"
width="49%" height="600"></iframe>
</body>
</html>
welcome.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>2102497 Jatin Bajaj</title>
</head>
<body style="background: rgba(172, 233, 229, 0.5);">
<h1><center>Welcome to CGC</center></h1>
<img src="https://www.cgc.edu.in/public/images/home/about.webp" width="100%">
<h2><center>Chandigarh Group of Colleges, Landran</center></h2>
Department of Information Technology
</body>
</html>
OUTPUT:-
Experiment-10
Department of Information Technology
THEORY: -
There are four ways to display text in the browser using JavaScript:
1.Using the document. write() method to write inside the tag.
2.Using the document. querySelector() method to replace the content of a specific element.
3.Using the console. ...
Using the alert() method to write text output to the popup box.
Code:-
<html>
<head>
<title>Jatin Bajaj 2102497</title></head>
<body>
<script>
window.alert("Chandigarh Engineering College. If you are a student of this college then press ok.");
</script>
</body>
</html>
Output:-
Department of Information Technology
Experiment-11
Aim: - Write a program in which when page loads it asks user to enter a number and then display
the table of that number up to 20.
Code:-
<html>
<head>
<title>Jatin Bajaj 2102497</title>
<script type="text/javascript"> value=window.prompt("Enter a value"); document.write("<table
border='2'>"); for(i=0;i<=20;i++){ document.write("<tr><td>"); document.write(value);
document.write(" X "); document.write(i); document.write("</td><td>"); document.write(value*i);
document.write("</td></tr>");
} document.write("</table>");
</script>
</head>
<body></body>
</html>
Output:-
Department of Information Technology
Department of Information Technology
Experiment-12
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jatin Bajaj 2102497</title>
</head>
<body>
<h1>User Login</h1>
<form name="login" onsubmit="return validate()">
<table>
<tr>
<td>User</td>
<td><input type="text" name="user"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="pass"></td>
</tr>
</table>
<input type="submit" name="SUBMIT">
</form>
<script>
function validate()
{
var check_user = document.login.user.value;
var user_validate = check_user.indexOf("_");
if( check_user.length <= 0 )
{
alert("Enter Username");
return false;
}
Output:-
Department of Information Technology
Experiment-13
Theory: - Cookies are data, stored in small text files, on your computer.When a web server has sent
a web page to a browser, the connection is shut down, and the server forgets everything about the
user. Cookies were invented to solve the problem "how to remember information about the user":
Code:-
<!DOCTYPE html>
<html>
<head>
<title>Jatin 2102497</title>
</head>
<body>
<input type="button" value="Set Cookie" onclick="setCookie()">
<input type="button" value="Get Cookie" onclick="getCookie('username')">
<script>
function setCookie()
{
var d = new Date();
d.setTime(d.getTime() + (1 * 24 * 60 * 60 *
1000));
var expires = "expires=";
document.cookie = "username=Jatin Bajaj" + "; " +
expires + d;
}
function getCookie(name){
var pattern = RegExp(name + "=.[^;]*")
var matched = document.cookie.match(pattern)
if(matched){
var cookie = matched[0].split('=')
alert("Cookie value=" + cookie[1]);
}
else
{
alert("Cookie not available");
}
return false
}
</script>
</body>
</html>
Department of Information Technology
Output:-
Department of Information Technology
Experiment-14
Aim: - Write a program in PHP to insert and read data from database.
Code:-
<?php
// database credentials
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "cec_2102497";
// connect to database
$conn = mysqli_connect($servername, $username, $password, $dbname);
// check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"]. " - Name: " . $row["name"]. " - Email: " . $row["email"]. "<br>";
}
} else {
echo "0 results";
}
Department of Information Technology
?>
</body>
</html>
Output:-
Department of Information Technology
Experiment-15
Code:-
<?php
header('Access-Control-Allow-Origin: *');
?>
<!DOCTYPE html>
<html>
<title>Jatin Bajaj 2102497</title>
<body>
<div id="demo">
<h1>Ajax Example</h1>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
</script>
</body>
</html>
Ajax_info.txt
<!DOCTYPE html>
<html>
<body>
<h1>Ajax Program</h1>
<p>AJAX stands for Asynchronous JavaScript And XML.</p>
</body>
</html>
Department of Information Technology
Output:-