Simple Password Generator Using JS

This is a simple password generator using javascript. This script generates random passwords of length 6. These code snippet can be used for those registration systems where user is assigned with an generated password for the first time. This password is based on 6 String sets which shuffle their index and generate a password !

Screenshots[Demo]:



The Code:
<script>
 function gene()
 {
  var set1='abcdefghi0',set2='jklmnopqu2',set3='ABCDEFG34s';
  var set4='HIJtuv569w',set5='xJKL!@#$7',set6='8&_MNOPQRS';
  var set7='TUVWXYZ012';
  var pas=set1.charAt(Math.floor((Math.random() * 10) + 1))+
  set2.charAt(Math.floor((Math.random() * 10) + 1))+
  set3.charAt(Math.floor((Math.random() * 10) + 1))+
  set4.charAt(Math.floor((Math.random() * 10) + 1))+
  set5.charAt(Math.floor((Math.random() * 10) + 1))+
  set6.charAt(Math.floor((Math.random() * 10) + 1))+
  set7.charAt(Math.floor((Math.random() * 10) + 1));
  prompt('The Password Generated is:',pas);
  var pas_id=document.getElementById('pas');
  var pas_p=document.createElement('p');
  pas_p.innerHTML='Pass: '+pas+'';
  pas_id.appendChild(pas_p);
 }
</script>
<button name='Generate' onclick='gene()'>Generate</button><br/>
<b>Generated Passwords :</b>
<div id='pas'></div>

Got new Ideas, Comment Them ! ;)

Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Employee Management System Using Inheritance in Java

Bit Stuffing Code Implementation in Java