1 <INPUT TYPE="button" VALUE="<% emt($label) %>" onclick="randomPass()">
2 <SCRIPT TYPE="text/javascript">
3 function randomPass() {
4 var lower='<% join('', 'a'..'z') %>';
5 var upper='<% join('', 'A'..'Z') %>';
6 var number='<% join('', '0'..'9') %>';
7 var symbol='`~!@#$%^&*-_=+:;<>,.?';
8 var pw_set=lower+upper+number+symbol;
10 pass.push(lower.charAt(Math.floor(Math.random() * lower.length)));
11 pass.push(upper.charAt(Math.floor(Math.random() * lower.length)));
12 pass.push(number.charAt(Math.floor(Math.random() * number.length)));
13 pass.push(symbol.charAt(Math.floor(Math.random() * symbol.length)));
17 pass.push(pw_set.charAt(Math.floor(Math.random() * pw_set.length)));
19 for(var j, x, i = pass.length; i; j = Math.floor(Math.random() * i), x = pass[--i], pass[i] = pass[j], pass[j] = x);
21 document.getElementById('<% $id %>').value = pass;
26 my $label = shift || 'Generate';