passwordgen.tt
<script type="text/javascript">
function genstring(strlen) {
if(!strlen) strlen = 6;
/// init
var alpha = "abcdefghijklmnopqrstuvwxyz";
var str = "";
/// loop
for(var i = 0; i < strlen; i++) {
var p = Math.floor( Math.random() * alpha.length );
var a = alpha.substring(p, p+1);
var r = Math.random();
if(r > 0.7) {
str += Math.round( Math.random() * 9 );
}
else if(r > 0.2) {
str += a;
}
else {
str += a.toUpperCase();
}
}
/// the end
var inp = document.getElementById('foo');
inp.value = str;
//return str;
}
window.onload=genstring;
</script>
<h2>Password generator</h2>
<input type="text" id="foo"> <input type="button" onclick="genstring()" value="Generate password">
<br>
<br>This generator should have the potensial to create 56.800.235.584 different passwords :)