Password Generator

vnm0

vnm0

Infinity Member
Joined
October 16, 2024
Messages
310
Reaction score
2,209
Points
93
  • Thread Author
  • #1
Code:
<!DOCTYPE html>
<html>
<head>
<title>Password Generator</title>
</head>
<body>
<h1>Password Generator</h1>
<button id="generate">Generate Password</button>
<input type="text" id="password" readonly>

<script>
// Function to generate a random password
function generatePassword(length) {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+";
let password = "";
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * charset.length);
password += charset[randomIndex];
}
return password;
}

// Function to update the password input field
function updatePasswordField() {
const passwordField = document..value = generatePassword(passwordLength);
}

// Attach the function to the "Generate Password" button
const generateButton = document..addEventListener("click", updatePasswordField);

// Generate an initial password when the page loads
updatePasswordField();
</script>
</body>
</html>
 
  • Like
Reactions: banadz
B

banadz

Advanced Member
Joined
January 6, 2026
Messages
156
Reaction score
12
Points
18
  • #2
kdututuldanspouvoir
 

Similar threads

FatalERROR
Replies
31
Views
2K
Golbenz2
G
shellant
Replies
32
Views
2K
simplis1ck
S
AccessNOTDenied
Replies
1
Views
1K
msterx1
M
penthouse776
Replies
6
Views
2K
tregfed
T
  • Tags
    encryption tools generator online safety password password generator password security