HTML Assignment
HTML Assignment
HTML Assignment
Student Name:…………………………………………………….
Course:…………………...Subject : ………………………………
Class & Section: …………………………………………………..
Certificate
MARKS
MAX OBTAINED
Signature of the Student Signature of the Staff Member
1. Create an HTML form that collects the following information
from users:
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<label for="password">Password:</label>
<label>Gender:</label><br>
<label for="male">Male</label><br>
<label for="female">Female</label><br>
<label for="other">Other</label><br><br>
<label for="hobbies">Hobbies:</label><br>
<label for="hobby1">Reading</label><br>
<label for="hobby2">Traveling</label><br>
<label for="hobby3">Sports</label><br><br>
<!-- Country -->
<label for="country">Country:</label>
<option value="Canada">Canada</option>
<option value="Australia">Australia</option>
<option value="India">India</option>
</select><br><br>
</form>
</body>
</html>
2. Design a simple website with two HTML pages:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Page</title>
</head>
<body>
<h1>Home Page</h1>
<p>Welcome to my website!</p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>About Me</title>
</head>
<body>
<h1>About Me</h1>
</body>
</html>
3. Build an application using HTML, Java script to do the
following tasks.
When the form runs in the Browser fill the textboxes with data.
Write JavaScript code that verifies that all textboxes has been
filled. If a textboxes has been left empty, popup an alert
indicating which textbox has been left empty.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form Validation</title>
<style>
body {
margin: 20px;
.form-container {
max-width: 400px;
margin: auto;
padding: 20px;
border-radius: 5px;
.form-container label {
display: block;
margin-bottom: 5px;
.form-container input {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border-radius: 5px;
.form-container button {
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
.form-container button:hover {
background-color: #0056b3;
</style>
</head>
<body>
<div class="form-container">
<h2>Form Validation</h2>
<form id="myForm">
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="age">Age:</label>
</form>
</div>
<script>
function validateForm() {
if (!input.value.trim()) {
allFilled = false;
alertMessage += `${input.previousElementSibling.innerText} is
required.\n`;
});
if (!allFilled) {
alert(alertMessage);
} else {
</script>
</body>
</html>
4. Create an HTML table to display a schedule with days of the
week and time slots. Include features like table headers,
rowspan, colspan, and table borders.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Schedule Table</title>
<style>
table {
width: 80%;
border-collapse: collapse;
text-align: center;
th, td {
padding: 10px;
th {
background-color: #f2f2f2;
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Time</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
</thead>
<tbody>
<tr>
<td>Science</td>
<td rowspan="2">History</td>
<td>Physical Education</td>
</tr>
<tr>
<td>Art</td>
<td>Music</td>
<td>English</td>
</tr>
<tr>
<td>Free Period</td>
<td>Library</td>
</tr>
<tr>
<td>Physics</td>
<td>Computer Lab</td>
<td>Geography</td>
<td>Biology</td>
<td>Chemistry</td>
</tr>
</tbody>
</table>
</body>
</html>