-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
55 lines (43 loc) · 1.17 KB
/
index.html
File metadata and controls
55 lines (43 loc) · 1.17 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Generate a Random Password
using JavaScript
</title>
</head>
<body style="text-align:center;">
<h1 style="color: royalblue">
Password Generator
</h1>
<h3>
Click on the button to
generate random password.
</h3>
<button onclick="gfg_Run()">
Click Here
</button>
<br>
<div>
<p id="geeks"></p>
</div>
<script>
var el_down = document.getElementById("geeks");
/* 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 gfg_Run() {
el_down.innerHTML = generateP();
}
</script>
</body>
</html>