TAE I Program Execution
TAE I Program Execution
Date: 31/08/2023
Session: 2023-24 (ODD Winter 2023)
Student Details:
Roll Number 40
Name Prathmesh vaidya
Semester 5th
Section B
Branch CSE
Sr.
Problem Statements
No
▪Fruits
I. Mango
II. Banana
1 III. Apple
*Vegetables
IV. Tomato
V. Potato
VI. Carrot
code:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Fruits and Vegetables</title>
</head>
<body>
<h1>Fruits and Vegetables</h1>
<ul>
<li><span style="color: red;">Fruits</span>
<ul>
<li style="color: blue;">Mango</li>
<li style="color: blue;">Banana</li>
<li style="color: blue;">Apple</li>
</ul>
</li>
<li><span style="color: red;">Vegetables</span>
<ul>
<li style="color: yellow;">Tomato</li>
<li style="color: yellow;">Potato</li>
<li style="color: yellow;">Carrot</li>
</ul>
</li>
</ul>
</body>
</html>
Write a JavaScript program to determine whether a given year is a leap year in the Gregorian
2 calendar.
code:-
function isLeapYear(year) {
if (year % 4 === 0) {
if (year % 100 === 0 && year % 400 !== 0) {
return false;
}
return true;
}
return false;
}
const yearToCheck = 2024; // Change this to the year you want to check
if (isLeapYear(yearToCheck)) {
console.log(`${yearToCheck} is a leap year.`);
} else {
console.log(`${yearToCheck} is not a leap year.`);
}
<script src="calculator.js"></script>
</body>
</html>
code in js :-
function appendToDisplay(value) {
const display = document.getElementById('display');
display.value += value;
}
function calculateResult() {
try {
const expression = document.getElementById('display').value;
const result = eval(expression);
document.getElementById('display').value = result;
} catch (error) {
document.getElementById('display').value = 'Error';
}
}
Design signup form to validate username, password, and phone numbers etc using Java script.
h2 { input[type="text"],
text-align: center; input[type="password"] {
} width: 100%;
padding: 10px;
form { margin-bottom: 15px;
border: 2px solid #ccc; border: 1px solid #ccc;
} }
}
input[type="radio"] { </script>
margin-right: 10px; </head>
} <body>
<h2>Employee Details</h2>
input[type="submit"] { <form name="signupForm"
background-color: #007BFF; onsubmit="return validateForm()"
color: #fff; method="post">
padding: 10px 20px; <label for="firstname">First
border: none; Name:</label>
cursor: pointer; <input type="text" id="firstname"
} name="firstname" required><br><br>
<label for="lastname">Last
input[type="submit"]:hover { Name:</label>
background-color: #0056b3; <input type="text" id="lastname"
} name="lastname" required><br><br>
</style> <label
<script> for="gender">Gender:</label>
function validateForm() { <input type="radio" id="male"
var username = name="gender" value="male"
document.forms["signupForm"]["usern required>
ame"].value; <label for="male">Male</label>
var password = <input type="radio" id="female"
document.forms["signupForm"]["pass name="gender" value="female"
word"].value; required>
var phoneNumber = <label
document.forms["signupForm"]["phon for="female">Female</label><br><br
eNumber"].value; >
<label
// Validate username for="employeeid">Employee
if (username === "") { ID:</label>
alert("Username must be <input type="text"
filled out"); id="employeeid" name="employeeid"
return false; required><br><br>
} <label
for="designation">Designation:</label
// Validate password >
if (password === "") { <input type="text"
alert("Password must be id="designation" name="designation"
filled out"); required><br><br>
return false; <label
} for="username">Username:</label>
<input type="text" id="username"
var phoneRegex = /^\d{10}$/; name="username" required><br><br>
if <label
(!phoneNumber.match(phoneRegex)) { for="password">Password:</label>
alert("Phone number must <input type="password"
contain 10 digits"); id="password" name="password"
return false; required><br><br>
<label
for="phoneNumber">Phone
Number:</label>
<input type="text"
id="phoneNumber"
name="phoneNumber"
required><br><br>
<input type="submit"
value="Submit">
</form>
</body>
</html>