-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractical_7.html
More file actions
33 lines (29 loc) · 811 Bytes
/
Copy pathpractical_7.html
File metadata and controls
33 lines (29 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Madanraj Sagar
<!DOCTYPE html>
<html>
<head>
<title>Simple Form</title>
</head>
<body>
<form onsubmit="return validateForm()">
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
<script>
function validateForm() {
let username = document.getElementById("username").value;
let password = document.getElementById("password").value;
if (username === "" || password === "") {
alert("Please fill in all fields.");
return false;
} else {
alert("Form submitted successfully!");
return true;
}
}
</script>
</body>
</html>