-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpasswordgenerator.html
More file actions
116 lines (105 loc) · 3.15 KB
/
passwordgenerator.html
File metadata and controls
116 lines (105 loc) · 3.15 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Generator</title>
<style>
body {
font-family: 'Arial', sans-serif;
text-align: center;
margin: 0;
padding: 0;
background-color: #333131;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}
.container {
max-width: 400px;
background-color: #f1eaea;
border-radius: 8px;
padding: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
position: relative;
animation: borderAnimation 2s infinite alternate;
width:400px;
}
.line {
position: absolute;
width: 100%;
height: 2px;
background-color: #007bff;
animation: moveLine 2s linear infinite;
}
h2 {
color: #333;
}
label, input {
display: block;
margin: 10px 0;
}
input[type="number"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #c70a0a;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
margin-top: 10px;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#generatedPassword {
animation: fadeIn 0.5s ease-in;
}
</style>
</head>
<body>
<div class="container">
<h2>Password Generator</h2>
<label for="passwordLength">Password Length:</label>
<input type="number" id="passwordLength" value="12" min="6" max="30">
<br>
<button onclick="generatePassword()">Generate Password</button>
<br>
<input type="text" id="generatedPassword" readonly>
</div>
<script>
function generatePassword() {
const passwordLength = document.getElementById('passwordLength').value;
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-+=";
let password = "";
for (let i = 0; i < passwordLength; i++) {
const randomIndex = Math.floor(Math.random() * charset.length);
password += charset.charAt(randomIndex);
}
document.getElementById('generatedPassword').value = password;
}
</script>
</body>
</html>