SHARE
TWEET

Generador passwords Javascript

a guest Feb 14th, 2012 768 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <title>Generar password</title>
  6.  
  7. <script language="Javascript" type="text/JavaScript">
  8. function generarPassword(form) {
  9.         var strCaracteresPermitidos = 'a,b,c,d,e,f,g,h,i,j,k,m,n,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9';
  10.         var strArrayCaracteres = new Array(34);
  11.         strArrayCaracteres = strCaracteresPermitidos.split(',');
  12.         var length = form.txtCampoLongitud.value, i = 0, j, tmpstr = "";
  13.         do {
  14.                 var randscript = -1
  15.                 while (randscript < 1 || randscript > strArrayCaracteres.length || isNaN(randscript)) {
  16.                         randscript = parseInt(Math.random() * strArrayCaracteres.length)
  17.                 }
  18.                 j = randscript;
  19.                 tmpstr = tmpstr + strArrayCaracteres[j];
  20.                 i = i + 1;
  21.         } while (i < length)
  22.         form.txtCampoPassword.value = tmpstr;
  23. }
  24. </script>
  25. </head>
  26.  
  27. <body>
  28. <form method="post" >
  29.         <input type="text" name="txtCampoPassword" size="20" class="txtTexto">
  30.         &nbsp;&nbsp;
  31.         <input name="button" type="button" class="btnSubir" onClick="generarPassword(this.form);" value="Generar">
  32.         <br>
  33.         Longitud password:
  34.         <input type="text" name="txtCampoLongitud" size="4" value="8" class="txtTexto">
  35.       </form>
  36. </body>
  37.  
  38. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top