***综合类***密码随机产生器
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中
<script language="javascript">
<!-- begin
function getrandomnum(lbound, ubound) {
return (math.floor(math.random() * (ubound - lbound)) + lbound);
}
function getrandomchar(number, lower, upper, other, extra) {
var numberchars = "0123456789";
var lowerchars = "abcdefghijklmnopqrstuvwxyz";
var upperchars = "abcdefghijklmnopqrstuvwxyz";
var otherchars = "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/? ";
var charset = extra;
if (number == true)
charset += numberchars;
if (lower == true)
charset += lowerchars;
if (upper == true)
charset += upperchars;
if (other == true)
charset += otherchars;
return charset.charat(getrandomnum(0, charset.length));
}
function getpassword(length, extrachars, firstnumber, firstlower, firstupper, firstother,
latternumber, latterlower, latterupper, latterother) {
var rc = "";
if (length > 0)
rc = rc + getrandomchar(firstnumber, firstlower, firstupper, firstother, extrachars);
for (var idx = 1; idx < length; ++idx) {
rc = rc + getrandomchar(latternumber, latterlower, latterupper, latterother, extrachars);
}
return rc;
}
// end -->
</script>
第二步:把如下代码加入到<body>区域中
<center>
<table width=80% border=0>
<tr align=center>
<td>
<form name="myform">
<table border=0>
<tr>
<td>
密码前几位包括:
</td>
<td>
<input type=checkbox name=firstnumber checked>数字
<input type=checkbox name=firstlower checked>小写字母
<input type=checkbox name=firstupper checked>大写字母
<input type=checkbox name=firstother>其它
</td>
</tr>
<tr>
<td>
密码后几位包括:
</td>
<td>
<input type=checkbox name=latternumber checked>数字
<input type=checkbox name=latterlower checked>小写字母
<input type=checkbox name=latterupper checked>大写字母
<input type=checkbox name=latterother>其它
</td>
</tr>
<tr>
<td>
密码长度:
</td>
<td>
<input type=text name=passwordlength value="8" size=3>
</td>
</tr>
<tr>
<td>
自定密码特征:
</td>
<td>
<input type=text name=extrachars size=20>
</td>
</tr>
</table>
</td>
</tr>
<tr align=center>
<td>
密码:
<input type=text name=password size=20>
<br>
<input type=button value="产生密码" onclick="document.myform.password.value =
getpassword(document.myform.passwordlength.value, document.myform.extrachars.value,
document.myform.firstnumber.checked, document.myform.firstlower.checked,
document.myform.firstupper.checked, document.myform.firstother.checked,
document.myform.latternumber.checked, document.myform.latterlower.checked,
document.myform.latterupper.checked, document.myform.latterother.checked);">
</form>
</td>
</tr>
</table>
</center>
--------------------------------------
http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页:
[1]