Skip to main content
Known Participant
April 30, 2018
Question

password generator is faulty

  • April 30, 2018
  • 1 reply
  • 1295 views

hi i used a password generator from a website flashkit.com, the code is as follows, but kicks out different variable ranging from 1 then 2 then 3 then 1 and is not constantly kicking out seven , can someone help me to change it please.

function newPassword(){

    var totalChar = 7; // number of chars in the password

    var salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";  // salt to select chars from

    var saltLength=salt.length;

    var userPass=""; // set the inital variable

    for (var xx=0;xx<totalChar;xx++){  // loop and create password

        userPass+=salt.charAt(Math.floor(Math.random()*saltLength));

    }

    return userPass;

}

button1.onRelease=function(){

    fred.text=newPassword();

}

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
April 30, 2018

Hi.

It always generates a password with 7 chars for me.

Please double-check if your text field is big enough to display 7 chars.

Regards,

JC

Known Participant
April 30, 2018

hi i increase the size and put the border off, and still doesnt,

Known Participant
April 30, 2018

this above is a picture with the border on.