-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
32 lines (26 loc) · 963 Bytes
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head><script src="script.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Random Password generator</title>
</head>
<body>
<div class="inputbox">
<h2>Random Password generator App</h2>
<input type="text" placeholder="Create Password" readonly="" id="password">
<div id="btn" onclick="getPassword();">Generate Password</div>
</div>
<script type="text/javascript">
function getPassword(){
var chars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUN=VWXYZ~!@#$%^&*()_+<>?:\|";
var passwordLength = 16;
var password = "";
for(var i=0; i<passwordLength; i++){
var randomNumber = Math.floor(Math.random() * chars.length);
password += chars.substring(randomNumber,randomNumber+1);
}
document.getElementById("password").value = password
}
</script>
</body>
</html>