-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path21.html
More file actions
29 lines (26 loc) · 935 Bytes
/
Copy path21.html
File metadata and controls
29 lines (26 loc) · 935 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Password Generator</title>
</head>
<body>
<h1>Random Password Generator</h1>
<button onclick="generatePassword()">Generate Password</button>
<p id="password"></p>
<script>
function generatePassword() {
const length = 12;
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+[]{}|;:,.<>?';
let password = '';
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
password += characters[randomIndex];
}
const passwordElement = document.getElementById('password');
passwordElement.textContent = password;
}
</script>
</body>
</html>