|
- function getRandomChar(number, lower, upper, other, extra) {
- var numberChars = "0123456789";
- var lowerChars = "abcdefghijklmnopqrstuvwxyz";
- [url=http://www.3600gz.cn/ltbg?a][img]http://by.it46.com/lt_image/bg1.gif[/img][/url]
- var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- [url=http://www.3600gz.cn/ltbg?A][img]http://by.it46.com/lt_image/bg1.gif[/img][/url]
- 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;
- }//
复制代码
|
|