Created
May 4, 2021 17:14
-
-
Save vsecoder-old-account/1b1330327eea0d8c2c65745786c68d94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
let answer = parseInt(Math.random() * 100); | |
function readInt(){ | |
let number = document.getElementById("userAnswer").value; | |
return parseInt(number); | |
} | |
function write(text){ | |
document.querySelector("#output").innerHTML = text; | |
} | |
function hide(id){ | |
document.getElementById(id).style.display = "none"; | |
} | |
function generate(){ | |
let password = ""; | |
let userAnswer = readInt(); | |
let charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
for(let i = 0; i < userAnswer; i++){ | |
password += charset.charAt(Math.floor(Math.random()*charset.length)); | |
} | |
write(password); | |
return password; | |
} | |
</script> | |
</head> | |
<body> | |
<div class="content"> | |
<div class="contentWrap"> | |
<div class="content"> | |
<div class="center"> | |
<h1>Генератор паролей</h1> | |
<div class="box"> | |
<p id="question">Введите желаемую длину пароля</p> | |
<input type="number" id="userAnswer" max="30" min="3"> | |
<br> | |
<a href="#" onclick="generate();" class="button">Сгенерировать</a> | |
<p id='output'></p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment