-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpassword_generators.js
More file actions
56 lines (43 loc) · 890 Bytes
/
password_generators.js
File metadata and controls
56 lines (43 loc) · 890 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
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
<!DOCTYPE HTML>
<html>
<head>
<title>
Generate a Random Password
using JavaScript
</title>
</head>
<body style="text-align:center;">
<h1 style="color: green">
Password Generator
</h1>
<h3>
Click on the button to
generate random password.
</h3>
<button onclick="run_pass()">
Click Here
</button>
<br>
<div>
<span id="password"></span>
</div>
<script>
var el_down = document.getElementById("password");
/* Function to generate combination of password */
function generateP() {
var pass = '';
var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz0123456789@#$';
for (let i = 1; i <= 8; i++) {
var char = Math.floor(Math.random()
* str.length + 1);
pass += str.charAt(char)
}
return pass;
}
function run_pass() {
el_down.innerHTML = generateP();
}
</script>
</body>
</html>