666-59-17 Lab Experiments Report - Web Programming
666-59-17 Lab Experiments Report - Web Programming
2. Student ID : 666-59-17
4. Email ID : [email protected]
7. Contact No : 01726829868
Experiment No 1
Input:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
Page 2 | 51
666-60-30
header {
background-color: #4CAF50;
color: white;
padding: 10px 0;
text-align: center;
font-size: 24px;
section {
margin: 20px 0;
padding: 15px;
background-color: #fff;
border-radius: 5px;
h2 {
color: #333;
form {
margin-bottom: 20px;
width: 100%;
Page 3 | 51
666-60-30
padding: 10px;
margin: 5px 0;
border-radius: 5px;
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
input[type="submit"]:hover {
background-color: #45a049;
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
table, th, td {
Page 4 | 51
666-60-30
th, td {
padding: 10px;
text-align: left;
th {
background-color: #4CAF50;
color: white;
ul {
list-style-type: none;
padding: 0;
ul li {
background-color: #e2e2e2;
margin: 5px 0;
padding: 10px;
border-radius: 5px;
footer {
text-align: center;
Page 5 | 51
666-60-30
margin-top: 20px;
color: #777;
</style>
</head>
<body>
<header>
Unique Webpage
</header>
<section>
<h2>Contact Us</h2>
<form>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="message">Message:</label>
</form>
</section>
Page 6 | 51
666-60-30
<section>
<h2>Frame Section</h2>
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/Qhaz36TZG5Y?si=xa-
Rw1tEd6CqIxD3&start=15"
frameborder="0"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>
</div>
</section>
<section>
<h2>Data Table</h2>
<table>
<tr>
<th>Name</th>
<th>Email</th>
Page 7 | 51
666-60-30
<th>Message</th>
</tr>
<tr>
<td>VIJOY</td>
<td>[email protected]</td>
<td>Hello!</td>
</tr>
<tr>
<td>Mahmud</td>
<td>[email protected]</td>
<td>Good day!</td>
</tr>
</table>
</section>
<section>
<h2>Useful Links</h2>
<ul>
</ul>
</section>
Page 8 | 51
666-60-30
<footer>
</footer>
</body>
</html>
Output:
Page 9 | 51
666-60-30
Experiment No 2
Page 10 | 51
666-60-30
Inline Style
Input:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p style="font-size: 18px; color: green;">This paragraph uses inline CSS to style its text
color and size.</p>
</body>
</html>
Output:
Page 11 | 51
666-60-30
Internal Style
Page 12 | 51
666-60-30
Input:
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f4f4f4;
h1 {
color: darkblue;
text-align: center;
p{
font-size: 16px;
color: darkgreen;
</style>
</head>
<body>
Page 13 | 51
666-60-30
</body>
</html>
Output:
External Style
Input:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
2.3 styles.css
body {
h1 {
Page 15 | 51
666-60-30
p{
Output:
Experiment No 3
Input:
<!DOCTYPE html>
Page 16 | 51
666-60-30
<html> <head>
</head>
<body>
<button onclick="displayEvenOdd()">Display</button>
<p id="result"></p>
<script>
function displayEvenOdd() {
if (i % 2 === 0) {
evenNumbers.push(i);
} else {
oddNumbers.push(i);
}}
document.getElementById("result").innerHTML =
Page 17 | 51
666-60-30
Output:
Experiment No 4
Input:
<!DOCTYPE html>
<html>
Page 18 | 51
666-60-30
<head>
<title>Sum of N Numbers</title>
</head>
<body>
<h3>Sum of N Numbers</h3>
<p id="sumResult"></p>
<script>
function calculateSum() {
const n = parseInt(document.getElementById("number").value);
let sum = 0;
sum += i;
</script>
</body>
</html>
Page 19 | 51
666-60-30
Output:
Experiment No 5
Registration page.
First Name (Name should contains alphabets and the
length should not be less than 6 characters).
Password (Password should not be less than 6 characters
length).
Page 20 | 51
666-60-30
Input:
<html><head>
</head> <body>
<h3>Registration Page</h3>
Page 21 | 51
666-60-30
<label for="password">Password:</label>
<label for="email">E-mail:</label>
<label for="address">Address:</label>
<button type="submit">Register</button>
</form>
<script>
function validateForm() {
Page 22 | 51
666-60-30
return false;
if (!lastName) {
return false;
return false;
if (!emailPattern.test(email)) {
return false;
if (!mobilePattern.test(mobile)) {
Page 23 | 51
666-60-30
return false;
if (!address) {
return false;
alert("Registration Successful!");
return true;
Output:
Page 24 | 51
666-60-30
Experiment No 6
Input:
<head>
Page 25 | 51
666-60-30
<meta charset="UTF-8">
<title>Digital Clock</title>
</head>
<body>
<div class="clock-container">
</div>
</body>
</html>
function updateClock() {
Page 26 | 51
666-60-30
timeElement.innerHTML = `${hours}:${minutes}:${seconds}
<span>${ampm}</span>`;
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"];
setInterval(updateClock, 1000);
updateClock();
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
Page 27 | 51
666-60-30
background-color: #2e2e38;
margin: 0;
.clock-container {
text-align: center;
background-color: #3d3d4e;
padding: 20px;
border-radius: 15px;
.time {
font-size: 100px;
font-weight: bold;
color: transparent;
.date {
font-size: 25px;
color: #ba9bc1;
Page 28 | 51
666-60-30
margin-top: 10px;
font-family:'Poppins', monospace
Output:
Page 29 | 51
666-60-30
Experiment No 7
Page 30 | 51
666-60-30
Input:
<head>
<link href="https://fonts.googleapis.com/css2?
family=Poppins:wght@400;600&display=swap" rel="stylesheet" />
<style type="text/css">
body {
Page 31 | 51
666-60-30
background-color: #f0f0f5;
margin: 20px;
padding: 0;
text-align: center;
h1 {
font-size: 28px;
color: #333;
form {
background-color: #fff;
padding: 20px;
border-radius: 10px;
display: inline-block;
input[type="number"], input[type="button"] {
padding: 10px;
font-size: 16px;
margin: 10px;
Page 32 | 51
666-60-30
border-radius: 5px;
width: 200px;
input[type="button"] {
background-color: #007bff;
color: white;
cursor: pointer;
input[type="button"]:hover {
background-color: #0056b3;
#output {
margin-top: 20px;
font-size: 18px;
color: #555;
white-space: pre-line;
</style>
<script type="text/javascript">
function generateFibonacci() {
var n = document.getElementById('fibonacciInput').value;
Page 33 | 51
666-60-30
n = parseInt(n);
if (isNaN(n) || n <= 0) {
return;
function displaySquares() {
var n = document.getElementById('squareInput').value;
n = parseInt(n);
if (isNaN(n) || n <= 0) {
return;
Page 34 | 51
666-60-30
document.getElementById('output').innerText = output;
</script>
</head>
<body>
<form>
<hr />
</form>
<div id="output"></div>
</body>
Page 35 | 51
666-60-30
</html>
Output:
Page 36 | 51
666-60-30
Experiment No 8
Page 37 | 51
666-60-30
Input:
<?php
$cookie_name = "lastVisit";
if(isset($_COOKIE[$cookie_name])) {
?>
Output:
Experiment No 9
Page 38 | 51
666-60-30
Input:
<?php
session_start();
if (!isset($_SESSION['views'])) {
$_SESSION['views'] = 0;
$_SESSION['views']++;
?>
Output:
Experiment No 10
Page 39 | 51
666-60-30
Input:
<!DOCTYPE html>
<head>
<title>Experiment 10</title>
</head>
<body>
</form>
Page 40 | 51
666-60-30
</body>
</html>
10store_data.php
<?php
// Database connection
// Check connection
if ($conn->connect_error) {
$name = $_POST['name'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$email = $_POST['email'];
$sql = "INSERT INTO users (name, address1, address2, email) VALUES ('$name',
'$address1', '$address2', '$email')";
} else {
Page 41 | 51
666-60-30
$conn->close();
?>
Output:
Page 42 | 51
666-60-30
Experiment No 11
Page 43 | 51
666-60-30
Input:
11_a_Sum of Digits.php
<?php
$number = 1234;
$sum = array_sum(str_split($number));
?>
11_b_Palindrome Check.php
<?php
$number = 121;
$reverse = strrev($number);
if ($number == $reverse) {
} else {
?>
Output:
11_a_Sum of Digits.php
Page 44 | 51
666-60-30
11_b_Palindrome Check.php
Experiment No 12
Input:
<!DOCTYPE html>
<html lang="en">
Page 45 | 51
666-60-30
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #f0f8ff;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
.container {
text-align: center;
padding: 20px;
background-color: #ffffff;
border-radius: 8px;
select {
Page 46 | 51
666-60-30
font-size: 16px;
padding: 10px;
margin: 10px;
border-radius: 4px;
width: 200px;
.capital {
font-weight: bold;
color: #007bff;
font-size: 24px;
</style>
</head>
<body>
<div class="container">
<h1>Select a Country</h1>
<option value="Canada">Canada</option>
Page 47 | 51
666-60-30
<option value="India">India</option>
<option value="Australia">Australia</option>
</select>
</div>
<script>
function showCapital() {
capital = "Ottawa";
capital = "London";
capital = "Canberra";
Page 48 | 51
666-60-30
</script>
</body>
</html>
Output:
Page 49 | 51
666-60-30
Page 50 | 51
666-60-30
Page 51 | 51