File 3
File 3
drop down box, text field and all other required HTML elements. Customize the CSS
and javascript to input and validate all data Create functions to perform
validation of each element, example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="form-container">
<h2>Student Registration Form</h2>
<form id="studentForm" onsubmit="return validateForm()">
</form>
</div>
<script src="script.js"></script>
</body>
</html>
CSS (styles.css)
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.form-container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 400px;
}
h2 {
text-align: center;
color: #333;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #555;
}
input[type="text"], input[type="date"], select {
width: 100%;
padding: 8px;
margin-bottom: 16px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="radio"], input[type="checkbox"] {
margin-right: 10px;
}
.error {
color: red;
font-size: 0.9em;
display: block;
margin-top: 5px;
}
button {
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}
button[type="submit"] {
background-color: #4CAF50;
color: white;
}
button[type="reset"] {
background-color: #f44336;
color: white;
}
button:hover {
opacity: 0.8;
}
JavaScript (script.js)
return isValid;
}