Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="password" name="password" id="password">
- <a href="#" class="showPass">Показать</a>
- <a href="#" class="genPass">Сегенерировать</a>
- <script>
- function pass_rand(){var result = '';var words = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';var max_position = words.length - 1;for( i = 0; i < 20; ++i ){position = Math.floor(Math.random() * max_position); result = result + words.substring(position, position + 1);} return result;}$('.showPass').click(function(e){e.preventDefault();var inputPsw = $('#password');if (inputPsw.attr('type') == 'password'){document.getElementById('password').setAttribute('type', 'text');}else {document.getElementById('password').setAttribute('type', 'password');}});$('.genPass').click(function(e){e.preventDefault();document.getElementById('password').setAttribute('type', 'text');$('#password').attr('value', pass_rand());});
- </script>
Add Comment
Please, Sign In to add comment