-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
25 lines (22 loc) · 849 Bytes
/
script.js
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
const passbox = document.getElementById("pass");
const length = 12;
const uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const lowercase = "abcdefghijklmnopqrstuvwxyz";
const number = "0123456789";
const symbol = "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~";
const allchar = uppercase + lowercase + number + symbol;
function generatepass() {
let passwrd = "";
passwrd += uppercase[Math.floor(Math.random() * uppercase.length)];
passwrd += lowercase[Math.floor(Math.random() * lowercase.length)];
passwrd += number[Math.floor(Math.random() * number.length)];
passwrd += symbol[Math.floor(Math.random() * symbol.length)];
while (length > passwrd.length) {
passwrd += symbol[Math.floor(Math.random() * symbol.length)]
}
passbox.value = passwrd;
}
function copypass(){
passbox.select();
document.execCommand("copy");
}