0% found this document useful (0 votes)
6 views4 pages

HTML, JavaScript, Css Form

Uploaded by

esraelemashwey
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

HTML, JavaScript, Css Form

Uploaded by

esraelemashwey
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<!

DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Login Form</title>

<style>

body {

font-family: Arial, sans-serif;

background: #f0f2f5;

display: flex;

justify-content: center;

align-items: center;

height: 100vh;

margin: 0;

.login-container {

background: white;

padding: 30px;

border-radius: 12px;

box-shadow: 0px 4px 10px rgba(0,0,0,0.2);

width: 300px;

.login-container h2 {
text-align: center;

margin-bottom: 20px;

color: #333;

.login-container input {

width: 100%;

padding: 10px;

margin: 10px 0;

border: 1px solid #ccc;

border-radius: 8px;

outline: none;

.login-container input:focus {

border-color: #4CAF50;

.login-container button {

width: 100%;

padding: 10px;

background: #4CAF50;

color: white;

border: none;

border-radius: 8px;

cursor: pointer;
font-size: 16px;

.login-container button:hover {

background: #45a049;

.error {

color: red;

font-size: 14px;

margin-top: 5px;

display: none;

</style>

</head>

<body>

<div class="login-container">

<h2>Login</h2>

<form id="loginForm">

<input type="text" id="username" placeholder="Username" />

<input type="password" id="password" placeholder="Password" />

<p class="error" id="errorMsg">Please fill in both fields.</p>

<button type="submit">Login</button>

</form>

</div>
<script>

const form = [Link]("loginForm");

const username = [Link]("username");

const password = [Link]("password");

const errorMsg = [Link]("errorMsg");

[Link]("submit", function(event) {

[Link]();

if ([Link]() === "" || [Link]() === "") {

[Link] = "block";

} else {

[Link] = "none";

alert("Login successful!\nUsername: " + [Link]);

// Here you can redirect or send data to server

});

</script>

</body>

</html>

You might also like