i am rather new to Javascript and i am having trouble making a function to generate a random password. The function gets called when i click a button. The empty and MD5 functions are included in a differant file.
function genPass(id) {
if(!empty(id)) {
var n = Math.ceil(Math.random()*(5*Math.random()));
n = n.substring(0,7);
//document.getElementById(id).value = n;
document.write(n);
}
}
The random() function returns integer type, maybe you want to make string first?
You can try it like that: