LABASSIGNMENT
LABASSIGNMENT
Question No. 01
Design the HTML Form of the Login and Sign Up Web page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login & Sign Up - CMMG</title>
<style>
/* Basic Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #24b024;
}
/* Container */
.form-container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 400px;
text-align: center;
}
h2 {
margin-bottom: 20px;
}
label {
display: block;
margin: 10px 0 5px;
text-align: left;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
width: 100%;
padding: 10px;
background-color: #634caf;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #4565a0;
}
p {
margin-top: 10px;
}
a {
color: #5b4caf;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* Toggle Visibility */
.form-section {
display: none;
}
.form-section.active {
display: block;
}
/* Welcome Page */
.welcome-section {
display: none;
}
</style>
</head>
<body>
<div class="form-container">
<!-- Login Form -->
<div class="form-section active" id="login-section">
<h2>CMMG </h2>
<form id="login-form">
<label for="login-email">Email:</label>
<input type="email" id="login-email" required placeholder="Enter
your email">
<label for="login-password">Password:</label>
<input type="password" id="login-password" required
placeholder="Enter your password">
<label for="signup-email">Email:</label>
<input type="email" id="signup-email" required placeholder="Enter
your email">
<label for="signup-password">Password:</label>
<input type="password" id="signup-password" required
placeholder="Create a password">
<script>
function toggleForm(formType) {
document.getElementById('login-
section').classList.remove('active');
document.getElementById('signup-
section').classList.remove('active');
function signUp() {
const username = document.getElementById('signup-username').value;
const email = document.getElementById('signup-email').value;
const password = document.getElementById('signup-password').value;
const confirmPassword = document.getElementById('signup-confirm-
password').value;
function login() {
const email = document.getElementById('login-email').value;
const password = document.getElementById('login-password').value;
function showWelcomePage() {
document.getElementById('login-section').style.display = 'none';
document.getElementById('signup-section').style.display = 'none';
document.getElementById('welcome-section').style.display = 'block';
}
function logout() {
document.getElementById('welcome-section').style.display = 'none';
document.getElementById('login-section').style.display = 'block';
document.getElementById('login-form').reset();
}
</script>
</body>
</html>