Css Manual
Css Manual
Experiment No: 1
Title of Experiment Write a javascript program to print the Fibonacci series till 10 number
Program:
<!DOCTYPE html>
<html>
<head>
<title>Arithmetic Operator</title>
</head>
<body>
<h1>Arithmetic Operator</h1>
<p>Enter first Number: </p>
<input type="number" id="firstnumber">
<p>Enter second Number: </p>
<input type="number" id="secondnumber">
<BR>
<BR>
<BR>
<button onclick="performOperation('add')">Add</button>
<button onclick="performOperation('subtract')">Subtract</button>
<button onclick="performOperation('multiply')">Multiply</button>
<button onclick="performOperation('divide')">Divide</button>
<button onclick="performOperation('mod')">Mod</button>
<script>
function performOperation(operation) {
let a = parseFloat(document.getElementById('firstnumber').value);
let b = parseFloat(document.getElementById('secondnumber').value);
let result;
switch (operation) {
case 'add':
result = a + b;
break;
case 'subtract':
result = a - b;
break;
case 'multiply':
result = a * b;
break;
case 'divide':
result = b !== 0 ? a / b : 'Cannot divide by zero.';
break;
case 'mod':
result = b !== 0 ? a % b : 'Cannot divide by zero.';
break;
}
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 2
Title of Experiment Write a javascript program to print the Fibonacci series till 10 number
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fibonacci Series</title>
</head>
<body>
<h1>Fibonacci Series</h1>
<script>
// Function to generate Fibonacci series
function fibonacciSeries(n) {
let fib = [0, 1]; // Initialize the first two numbers of the series
return fib;
}
document.write("</ul>");
</script>
</body>
</html>
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 3
Title of Experiment Write a Program to create new array using elements of another array.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create New Array Example</title>
</head>
<body>
<h1>Create New Array from Existing Array</h1>
<script>
// Original array
const originalArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// Display the original array and the new array using document.write
document.write("<p>Original Array: [" + originalArray.join(", ") + "]</p>");
document.write("<p>New Array (squared values): [" + newArray.join(", ") + "]</p>");
</script>
</body>
</html>
Output:
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 4
Title of Experiment Calculate the factorial of a number by 1)calling function without
argument 2)calling function with argument
Calculate the factorial of a number by 1)calling function without argument 2)calling function
with argument
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Factorial Calculation</title>
</head>
<body>
<h1>Factorial Calculation</h1>
<script>
// Function to calculate factorial with argument
function factorial(n) {
if (n === 0 || n === 1) {
return 1;
}
return n * factorial(n - 1);
}
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 5
Title of Experiment Write a program to remove white space between the string.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script>
function removeWhiteSpaces(str) {
// Example strings
const originalString = " This is an example string with white spaces. ";
</script>
</body>
</html>
Output:
DEPARTMENT OF INFORMATION
TECHNOLOGY
Subject: client slide script language Subject Code:
Semester:5th Semester Course: IF5IC
Laboratory No:lab3 Name of Subject Teacher: Yogita Khandagle
Name of Student: Isha Mahendra Nikam Roll Id: 22202C0044
Experiment No: 6
Title of Experiment Write a javascript program for changing attributes values dynamically
html>
<head>
</head>
<body>
<h4>Click the button to change the <i> background-color <i> of the below text.</h4>
<script>
function changeBackground() {
</script>
</body>
</html>
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Subject: client slide script language Subject Code:
Semester:5th Semester Course: IF5IC
Laboratory No:lab3 Name of Subject Teacher: Yogita Khandagle
Name of Student: Isha Mahendra Nikam Roll Id: 22202C0044
Experiment No: 7
Title of Experiment Develop a program for as we enter the firstname and lastname,email is
automatically generated
PROGRAM=
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Email Generator</title>
<style>
body {
margin: 20px;
.container {
max-width: 400px;
margin: auto;
input, button {
width: 100%;
padding: 10px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 5px;
#emailOutput {
font-weight: bold;
color: #333;
</style>
</head>
<body>
<div class="container">
<h1>Email Generator</h1>
<form id="emailForm">
</form>
<p id="emailOutput"></p>
</div>
<script src="script.js"></script>
</body>
</html>
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Code:
<html>
<head>
<title>Key Event Demo</title>
<style>
body {
bgcolor: ""
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
#output {
font-size: 24px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Press Any Key!</h1>
<div id="output">You pressed: </div>
<script>
document.addEventListener('keydown', function(event) {
const key = event.key;
document.getElementById('output').textContent = `You pressed: ${key}`;
});
</script>
</body>
</html>
Output:
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 9
Title of Experiment Write a program to Display and enabled textfield.
Code:
<html>
<head>
<title>Enable/Disable Text Field</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
</style>
</head>
<body>
<script>
const textField = document.getElementById('myTextField');
const toggleButton = document.getElementById('toggleButton');
toggleButton.addEventListener('click', () => {
if (textField.disabled) {
textField.disabled = false;
toggleButton.textContent = 'Enable';
} else {
textField.disabled = true;
toggleButton.textContent = 'Disable';
}
});
</script>
</body>
</html>
Output:
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 10
Title of Experiment Write a webpage that display from that contains an input for username
and password.user is prompted to enter the input username and
password become value of the cookies write a javascript function for
storing the cookies
Code:
<html>
<head>
<title>Username and Password Form with Cookies</title>
</head>
<body>
<h2>Login Form</h2>
<form onsubmit="storeCookies(event)">
<label for="username">Username:</label>
<br><br>
<label for="password">Password:</label>
<button type="submit">Submit</button>
</form>
<script>
function storeCookies(event) {
</script>
</body>
</html>
Output:
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 11
Title of Experiment Write a program to Open a new windows and close that windows on
button click event using open()and close()
CODE=
<html>
<head>
</head>
flex-direction: column;
justify-content:center;
align-items:center;">
text-align: center;">
GeeksforGeeks
</h1>
<button onclick="windowOpen()">
Open GeeksforGeeks
</button>
<button onclick="windowClose()">
Close GeeksforGeeks
</button>
</div>
<script>
let Window;
function windowOpen() {
Window = window.open(
"https://www.geeksforgeeks.org/",
function windowClose() {
Window.close();
</script>
</body>
</html>
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 12
Title of Experiment Write HTML code to design a form that displays textboxes for
accepting UserID and Aadhar No. and a SUBMIT button. UserlD
should contain 10 alphanumeric characters and must start with Capital
Letter. Aadhar No. should contain 12 digits in the format nnnn nnnn
nnnn. Write JavaScript code to validate the UserID and Aadhar No.
when the user clicks on SUBMIT button.
CODE=
<html>
<head>
<title>Form Validation</title>
<style>
form {
width: 300px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 8px;
}
input {
width: 100%;
padding: 8px;
margin-bottom: 12px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
padding: 10px;
width: 100%;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.error {
color: red;
font-size: 14px;
display: inline; /* Make div behave like span */
}
</style>
</head>
<body>
<button type="submit">SUBMIT</button>
</form>
<script>
function validateForm() {
let userID = document.getElementById("userID").value;
let aadharNo = document.getElementById("aadharNo").value;
userIDError.textContent = "";
aadharError.textContent = "";
</body>
</html>
OUTPUT=
DEPARTMENT OF INFORMATION
TECHNOLOGY
Experiment No: 13
Title of Experiment Write a JavaScript program to design HTML page with books
information in tabular format, use rollovers to display the discount
information.
CODE=
<html>
<head>
<title>Book Store</title>
<style>
table {
width: 70%;
margin: 20px auto;
border-collapse: collapse;
font-family: Arial, sans-serif;
}
th, td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
th {
background-color: #f4f4f4;
}
td {
position: relative;
}
.discount-info {
display: none;
position: absolute;
top: 100%;
left: 0;
width: 180px;
padding: 8px;
background-color: yellow;
border: 1px solid #ddd;
font-size: 14px;
z-index: 10;
}
td:hover .discount-info {
display: block;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Book Title</th>
<th>Author</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td onmouseover="showDiscount(this)" onmouseout="hideDiscount(this)">
The Great Gatsby
<div class="discount-info">10% discount on all orders</div>
</td>
<td>F. Scott Fitzgerald</td>
<td>$15.99</td>
</tr>
<tr>
<td onmouseover="showDiscount(this)" onmouseout="hideDiscount(this)">
To Kill a Mockingbird
<div class="discount-info">15% discount for students</div>
</td>
<td>Harper Lee</td>
<td>$12.99</td>
</tr>
<tr>
<td onmouseover="showDiscount(this)" onmouseout="hideDiscount(this)">
1984
<div class="discount-info">20% discount for members</div>
</td>
<td>George Orwell</td>
<td>$18.50</td>
</tr>
<tr>
<td onmouseover="showDiscount(this)" onmouseout="hideDiscount(this)">
Moby Dick
<div class="discount-info">5% discount on bulk orders</div>
</td>
<td>Herman Melville</td>
<td>$14.20</td>
</tr>
</tbody>
</table>
<script>
function showDiscount(element) {
let discountInfo = element.querySelector('.discount-info');
discountInfo.style.display = 'block';
}
function hideDiscount(element) {
let discountInfo = element.querySelector('.discount-info');
discountInfo.style.display = 'none';
}
</script>
</body>
</html>
OUTPUT=