Security Password Generator With JavaScript

Author
In CSS Tutorial Dec 23, 2017
generate-passwd

Just another pure JavaScript plugin used for generating strong random password strings with just one click.

How to use it:

The html for the password generator.

<label for="blocks-length">Blocks length <input type="number" min="1" max="10" value="4" id="blocks-length"> </label> <label for="blocks">Number of blocks <input type="number" min="1" max="10" value="4" id="blocks"> </label> <label for="blocks-separator">Blocks separator <input type="text" id="blocks-separator" value="-"> </label> <button type="button" id="generate-passwd">Suggest Password</button>

Create an element to display the generated password.

<output id="wrapper"></output>

Include the main JavaScript on the web page when needed.

<script src="https://www.cssscript.com/generate-passwd.js"></script>

The JavaScript to activate the password generator.

function testGeneratePasswd() { var wrapper = document.getElementById('wrapper'), blocksLength = document.getElementById('blocks-length').value, blocksNumber = document.getElementById('blocks').value, blocksSeparator = document.getElementById('blocks-separator').value, passwd = generatePasswd({ blocksLength: blocksLength, blocksNumber: blocksNumber, blocksSeparator: blocksSeparator }); wrapper.innerHTML = passwd; } document.getElementById('generate-passwd').addEventListener('click', function() { testGeneratePasswd(); });

The post Security Password Generator With JavaScript appeared first on CSS Script.

 

Leave a Reply

Your email address will not be published. Required fields are marked *