Lab Manual WT
Lab Manual WT
Lab Manual WT
Faculty Name:
Arti Panwar
Student Name: Devender Singh
Roll No. : 21BC8011
Course: BCA
Semester: V
Batch: 2023-2024
INDEX
HOME PAGE: The static home page must contain three frames.
LOGIN PAGE
CATOLOGUE PAGE: The catalogue page should contain the details of all
the books available in the web site in a table.
REGISTRATION PAGE
Program code:
1. Home page
<!DOCTYPE html>
<html>
<head>
<title>Online Book Store</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to our Online Book Store</h1>
</header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="catalogue.html">Catalogue</a></li>
</ul>
</nav>
<section>
<h2>Featured Books</h2>
<! -- Add book thumbnails and descriptions here -->
</section>
<footer>
© 2023 Online Book Store
</footer>
</body>
</html>
Output
Login.html
<!DOCTYPE html>
<html>
<head>
<title>Login - Online Book Store</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Login to your account</h1>
</header>
<section>
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username"
required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"
required><br><br>
<input type="submit" value="Login">
</form>
</section>
<footer>
© 2023 Online Book Store
</footer>
</body>
</html>
OUTPUT
Catalogue.html
<!DOCTYPE html>
<html>
<head>
<title>Book Catalogue - Online Book Store</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Book Catalogue</h1>
</header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="catalogue.html">Catalogue</a></li>
</ul>
</nav>
<section>
<h2>Available Books</h2>
<table>
<tr>
<th>Title</th>
<th>Author</th>
<th>Price</th>
</tr>
<tr>
<td>The Great Gatsby</td>
<td>F. Scott Fitzgerald</td>
<td>800</td>
</tr>
<tr>
<td>To Kill a Mockingbird</td>
<td>Harper Lee</td>
<td>Rs300</td>
</tr>
<tr>
<td>1984</td>
<td>George Orwell</td>
<td>Rs 200</td>
</tr>
</table>
</section>
<footer>
© 2023 Online Book Store
</footer>
</body>
</html>
OUTPUT
2. Develop and demonstrate the usage of inline, internal, and external
style sheet using CSS.
Program code:
Inline CSS:
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS Example</title>
</head>
<body>
<h1 style="color: blue;">This is a heading with inline CSS</h1>
<p style="font-size: 18px;">This is a paragraph with inline CSS.</p>
</body>
</html>
OUTPUT:
Internal CSS:
<!DOCTYPE html>
<html>
<head>
<title>Internal CSS Example</title>
<style>
h1 {
color: green;
}
p{
font-size: 24px;
}
</style>
</head>
<body>
<h1>This is a heading with internal CSS</h1>
<p>This is a paragraph with internal CSS.</p>
</body>
</html>
OUTPUT
External CSS:
<!DOCTYPE html>
<html>
<head>
<title>External CSS Example</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>This is a heading with external CSS</h1>
<p>This is a paragraph with external CSS.</p>
</body>
</html>
OUTPUT
Program code:
a) Display Date:
<!DOCTYPE html>
<html>
<head>
<title>Display Date</title>
<script>
function display Date() {
// Get the current date
var current Date = new Date();
// Extract the date components (day, month, year)
var day = currentDate.getDate();
var month = currentDate.getMonth() + 1; // Months are zero-
based
var year = currentDate.getFullYear();
b. Factorial of a Number:
<!DOCTYPE html>
<html>
<head>
<title>Factorial Calculator</title>
<script>
function calculateFactorial() {
// Get a number from the user using prompt
var num = parseInt(prompt("Enter a number:"));
Output
4. Write an HTML page that contains a selection box with a list of 5
countries. When the user selects a country, its capital should be printed
next in the list. Add CSS to customize the properties of the font of the
capital (color,bold and font size)
PROGRAM CODE:
<!DOCTYPE html>
<html>
<head>
<title>Country Capitals</title>
<style>
/* CSS to style the font of the capital */
#capital {
color: blue; /* Change the color to your preferred color */
font-weight: bold; /* Make it bold */
font-size: 18px; /* Change the font size to your preferred size */
}
</style>
<script>
// JavaScript function to display the capital based on the selected
country
function displayCapital() {
var countrySelect = document.getElementById("countrySelect");
var capitalDisplay = document.getElementById("capital");
OUTPUT:
5.Develop and demonstrate PHP Script for the following problems: a)
Write a PHP Script to find out the Sum of the Individual Digits. b)
Write a PHP Script to check whether the given number is Palindrome
or not.
Here are PHP scripts for both of the problems you mentioned:
a) Sum of Individual Digits:
Program code:
OUTPUT
PROGRAM CODE
OUTPUT
6. Write a program to design a simple calculator using JavaScript
Program code
<!DOCTYPE html>
<html>
<head>
<title>Simple Calculator</title>
<style>
input[type="text"] {
width: 150px;
}
</style>
</head>
<body>
<h1>Simple Calculator</h1>
<form name="calculator">
<input type="text" name="display" id="display" readonly>
<br>
<input type="button" value="1" onclick="appendToDisplay('1')">
<input type="button" value="2" onclick="appendToDisplay('2')">
<input type="button" value="3" onclick="appendToDisplay('3')">
<input type="button" value="+" onclick="appendToDisplay('+')">
<br>
<input type="button" value="4" onclick="appendToDisplay('4')">
<input type="button" value="5" onclick="appendToDisplay('5')">
<input type="button" value="6" onclick="appendToDisplay('6')">
<input type="button" value="-" onclick="appendToDisplay('-')">
<br>
<input type="button" value="7" onclick="appendToDisplay('7')">
<input type="button" value="8" onclick="appendToDisplay('8')">
<input type="button" value="9" onclick="appendToDisplay('9')">
<input type="button" value="*" onclick="appendToDisplay('*')">
<br>
<input type="button" value="C" onclick="clearDisplay()">
<input type="button" value="0" onclick="appendToDisplay('0')">
<input type="button" value="=" onclick="calculate()">
<input type="button" value="/" onclick="appendToDisplay('/')">
</form>
<script>
function appendToDisplay(value) {
document.calculator.display.value += value;
}
function clearDisplay() {
document.calculator.display.value = '';
}
function calculate() {
try {
document.calculator.display.value =
eval(document.calculator.display.value);
} catch (error) {
document.calculator.display.value = 'Error';
}
}
</script>
</body>
</html>
OUTPUT
Write a program to design a simple calculator using PHP
<!DOCTYPE html>
<html>
<head>
<title>Simple Calculator</title>
</head>
<body>
<h1>Simple Calculator</h1>
<?php
if (isset($_POST['calculate'])) {
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$operator = $_POST['operator'];
switch ($operator) {
case "+":
$result = $num1 + $num2;
break;
case "-":
$result = $num1 - $num2;
break;
case "*":
$result = $num1 * $num2;
break;
case "/":
if ($num2 == 0) {
echo "Division by zero is not allowed.";
} else {
$result = $num1 / $num2;
}
break;
default:
echo "Invalid operator";
}
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
<script>
function validateForm() {
var firstName =
document.forms["registrationForm"]["firstName"].value;
var lastName =
document.forms["registrationForm"]["lastName"].value;
var password =
document.forms["registrationForm"]["password"].value;
var email = document.forms["registrationForm"]["email"].value;
var mobile = document.forms["registrationForm"]["mobile"].value;
var address = document.forms["registrationForm"]["address"].value;
// Validate Password
if (!passwordRegex.test(password)) {
alert("Password should be at least 6 characters long.");
return false;
}
// Validate Email
if (!emailRegex.test(email)) {
alert("Invalid Email format. Please use [email protected].");
return false;
}
// Validate Address
if (address.trim() === "") {
alert("Address cannot be empty.");
return false;
}
OUTPUT
8. Develop and demonstrate JavaScript with POP-UP boxes and functions
for the following problems: a) Input: A number n obtained using prompt
Output: A multiplication table of numbers from 1 to 10 of n using alert b)
Input: A number n obtained using prompt and add another number using
confirm Output: Sum of the entire n numbers using alert
Program code
Multiplication Table:
<!DOCTYPE html>
<html>
<head>
<title>Multiplication Table</title>
</head>
<body>
<h1>Multiplication Table</h1>
<script>
function displayMultiplicationTable() {
// Prompt user for a number
var n = parseInt(prompt("Enter a number:"));
if (!isNaN(n)) {
var table = "Multiplication table of " + n + ":\n";
alert(table);
} else {
alert("Invalid input. Please enter a valid number.");
}
}
</script>
OUTPUT
<script>
function calculateSum() {
// Prompt user for a number
var n = parseInt(prompt("Enter a
number:"));
if (!isNaN(n)) {
// Confirm if the user wants to
add another number
var addAnother = confirm("Do you want to add another
number?");
if (addAnother) {
var additionalNumber = parseInt(prompt("Enter another
number:"));
if (!isNaN(additionalNumber)) {
n += additionalNumber;
} else {
alert("Invalid input for the additional number.");
}
}
OUTPUT