Please follow basic human etiquette. Sorry for you not having a keen
grasp of the obvious in the ridiculously short 2 message thread you
could not make associated connections to. I think you just wanted to
pitch a knife-fight vs. your honest claim you could not make heads or
tails of it? Sure. Please do not post here either unless you want to
help. Unless I am wrong, Ok?
-Cindy
this function from phpmyadmin
so you shouldnt use it verbatim unless you then GPL you source code.
/**
* Generate a new password, which may then be copied to the form
* with suggestPasswordCopy().
*
* @param string the form name
*
* @return boolean always true
*/
function suggestPassword() {
var pwchars =
"abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ.,:";
var passwordlength = 16; // do we want that to be dynamic? no,
keep it simple
var passwd = document.getElementById('generated_pw');
passwd.value = '';
for ( i = 0; i < passwordlength; i++ ) {
passwd.value += pwchars.charAt( Math.floor( Math.random() *
pwchars.length ) )
}
return passwd.value;
}
you need markup like so
<input id="button_generate_password" value="Generate"
onclick="suggestPassword()" type="button">
<input name="generated_pw" id="generated_pw" type="text">
now all you need is
*set the number of digits to 5 as required
*an onmousedown instead of onclick to call the function
*a way of using setInterval with a certain number of milliseconds to
repeat the triggering of the suggestPassword function
*an onmouseup event, which cancels this.