-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
28 lines (26 loc) · 831 Bytes
/
app.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
26
27
28
btn.onclick = ()=>{
let password = "";
let characterList = "";
let inputsFileds = document.querySelectorAll('input')
if(inputsFileds[2].checked){
characterList += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
if(inputsFileds[3].checked){
characterList += "abcdefghijklmnopqrstuvwxyz";
}
if(inputsFileds[4].checked){
characterList += "~`@#$%^&*()_-+=}]{[|?/.>,<";
}
if(inputsFileds[5].checked){
characterList += "0123456789";
}
let passwordLength = inputsFileds[1].value;
for(let i=1; i<=passwordLength; i++){
password += characterList.charAt(Math.floor(Math.random()*characterList.length));
}
inputsFileds[0].value = password;
copyPassword.onclick = ()=>{
inputsFileds[0].select();
document.execCommand("copy");
}
}