<
div class
=
"
from-nav
"
>
< div class = " Mtitle " >< span > 密码: </ span ></ div >
< div class = " Mright " >< input name = " password " type = " password " id = " password " size = " 20 " class = " colorblue " onfocus = " this.className='colorfocus'; " onblur = " this.className='colorblue'; " onkeyup = " return loadinputcontext(this); " />< span > 不得少于6个字符 </ span >
</ div >
</ div >
< div class = " from-nav " >
< div class = " Mtitle " >< span > 密码强度: </ span ></ div >
< div class = " Mright " >
< script type = " text/javascript " >
var PasswordStrength = ... {
Level : ["极佳","一般","较弱","太短"],
LevelValue : [15,10,5,0],//强度值
Factor : [1,2,5],//字符加数,分别为字母,数字,其它
KindFactor : [0,0,10,20],//密码含几种组成的加数
Regex : [/[a-zA-Z]/g,/d/g,/[^a-zA-Z0-9]/g] //字符正则数字正则其它正则
}
PasswordStrength.StrengthValue = function (pwd)
... {
var strengthValue = 0;
var ComposedKind = 0;
for(var i = 0 ; i < this.Regex.length;i++)
...{
var chars = pwd.match(this.Regex[i]);
if(chars != null)
...{
strengthValue += chars.length * this.Factor[i];
ComposedKind ++;
}
}
strengthValue += this.KindFactor[ComposedKind];
return strengthValue;
}
PasswordStrength.StrengthLevel = function (pwd)
... {
var value = this.StrengthValue(pwd);
for(var i = 0 ; i < this.LevelValue.length ; i ++)
...{
if(value >= this.LevelValue[i] )
return this.Level[i];
}
}
function loadinputcontext(o)
... {
var showmsg=PasswordStrength.StrengthLevel(o.value);
switch(showmsg)
...{
case "太短": showmsg+=" <img src='images/level/1.gif' width='88' height='11' />";break;
case "较弱": showmsg+=" <img src='images/level/2.gif' width='88' height='11' />";break;
case "一般": showmsg+=" <img src='images/level/3.gif' width='88' height='11' />";break;
case "极佳": showmsg+=" <img src='images/level/4.gif' width='88' height='11' />";break;
}
document.getElementById('showmsg').innerHTML = showmsg;
}
function htmlEncode(source, display, tabs)
... {
function special(source)
...{
var result = '';
for (var i = 0; i < source.length; i++)
...{
var c = source.charAt(i);
if (c < ' ' || c > '~')
...{
c = '&#' + c.charCodeAt() + ';';
}
result += c;
}
return result;
}
function format(source)
...{
// Use only integer part of tabs, and default to 4
tabs = (tabs >= 0) ? Math.floor(tabs) : 4;
// split along line breaks
var lines = source.split(/ | | /);
// expand tabs
for (var i = 0; i < lines.length; i++)
...{
var line = lines[i];
var newLine = '';
for (var p = 0; p < line.length; p++)
...{
var c = line.charAt(p);
if (c === ' ')
...{
var spaces = tabs - (newLine.length % tabs);
for (var s = 0; s < spaces; s++)
...{
newLine += ' ';
}
}
else
...{
newLine += c;
}
}
// If a line starts or ends with a space, it evaporates in html
// unless it's an nbsp.
newLine = newLine.replace(/(^ )|( $)/g, ' ');
lines[i] = newLine;
}
// re-join lines
var result = lines.join('<br />');
// break up contiguous blocks of spaces with non-breaking spaces
result = result.replace(/ /g, ' ');
// tada!
return result;
}
var result = source;
// ampersands (&)
result = result.replace(/&/g,'&');
// less-thans (<)
result = result.replace(/</g,'<');
// greater-thans (>)
result = result.replace(/>/g,'>');
if (display)
...{
// format for display
result = format(result);
}
else
...{
// Replace quotes if it isn't for display,
// since it's probably going in an html attribute.
result = result.replace(new RegExp('"','g'), '"');
}
// special characters
result = special(result);
// tada!
return result;
}
var profile_username_toolong = ' 对不起,您的用户名超过 20 个字符,请输入一个较短的用户名。 ' ;
var profile_username_tooshort = ' 对不起,您输入的用户名小于3个字符, 请输入一个较长的用户名。 ' ;
var profile_username_pass = " 可用 " ;
function checkusername(username)
... {
var unlen = username.replace(/[^
< div class = " Mtitle " >< span > 密码: </ span ></ div >
< div class = " Mright " >< input name = " password " type = " password " id = " password " size = " 20 " class = " colorblue " onfocus = " this.className='colorfocus'; " onblur = " this.className='colorblue'; " onkeyup = " return loadinputcontext(this); " />< span > 不得少于6个字符 </ span >
</ div >
</ div >
< div class = " from-nav " >
< div class = " Mtitle " >< span > 密码强度: </ span ></ div >
< div class = " Mright " >
< script type = " text/javascript " >
var PasswordStrength = ... {
Level : ["极佳","一般","较弱","太短"],
LevelValue : [15,10,5,0],//强度值
Factor : [1,2,5],//字符加数,分别为字母,数字,其它
KindFactor : [0,0,10,20],//密码含几种组成的加数
Regex : [/[a-zA-Z]/g,/d/g,/[^a-zA-Z0-9]/g] //字符正则数字正则其它正则
}
PasswordStrength.StrengthValue = function (pwd)
... {
var strengthValue = 0;
var ComposedKind = 0;
for(var i = 0 ; i < this.Regex.length;i++)
...{
var chars = pwd.match(this.Regex[i]);
if(chars != null)
...{
strengthValue += chars.length * this.Factor[i];
ComposedKind ++;
}
}
strengthValue += this.KindFactor[ComposedKind];
return strengthValue;
}
PasswordStrength.StrengthLevel = function (pwd)
... {
var value = this.StrengthValue(pwd);
for(var i = 0 ; i < this.LevelValue.length ; i ++)
...{
if(value >= this.LevelValue[i] )
return this.Level[i];
}
}
function loadinputcontext(o)
... {
var showmsg=PasswordStrength.StrengthLevel(o.value);
switch(showmsg)
...{
case "太短": showmsg+=" <img src='images/level/1.gif' width='88' height='11' />";break;
case "较弱": showmsg+=" <img src='images/level/2.gif' width='88' height='11' />";break;
case "一般": showmsg+=" <img src='images/level/3.gif' width='88' height='11' />";break;
case "极佳": showmsg+=" <img src='images/level/4.gif' width='88' height='11' />";break;
}
document.getElementById('showmsg').innerHTML = showmsg;
}
function htmlEncode(source, display, tabs)
... {
function special(source)
...{
var result = '';
for (var i = 0; i < source.length; i++)
...{
var c = source.charAt(i);
if (c < ' ' || c > '~')
...{
c = '&#' + c.charCodeAt() + ';';
}
result += c;
}
return result;
}
function format(source)
...{
// Use only integer part of tabs, and default to 4
tabs = (tabs >= 0) ? Math.floor(tabs) : 4;
// split along line breaks
var lines = source.split(/ | | /);
// expand tabs
for (var i = 0; i < lines.length; i++)
...{
var line = lines[i];
var newLine = '';
for (var p = 0; p < line.length; p++)
...{
var c = line.charAt(p);
if (c === ' ')
...{
var spaces = tabs - (newLine.length % tabs);
for (var s = 0; s < spaces; s++)
...{
newLine += ' ';
}
}
else
...{
newLine += c;
}
}
// If a line starts or ends with a space, it evaporates in html
// unless it's an nbsp.
newLine = newLine.replace(/(^ )|( $)/g, ' ');
lines[i] = newLine;
}
// re-join lines
var result = lines.join('<br />');
// break up contiguous blocks of spaces with non-breaking spaces
result = result.replace(/ /g, ' ');
// tada!
return result;
}
var result = source;
// ampersands (&)
result = result.replace(/&/g,'&');
// less-thans (<)
result = result.replace(/</g,'<');
// greater-thans (>)
result = result.replace(/>/g,'>');
if (display)
...{
// format for display
result = format(result);
}
else
...{
// Replace quotes if it isn't for display,
// since it's probably going in an html attribute.
result = result.replace(new RegExp('"','g'), '"');
}
// special characters
result = special(result);
// tada!
return result;
}
var profile_username_toolong = ' 对不起,您的用户名超过 20 个字符,请输入一个较短的用户名。 ' ;
var profile_username_tooshort = ' 对不起,您输入的用户名小于3个字符, 请输入一个较长的用户名。 ' ;
var profile_username_pass = " 可用 " ;
function checkusername(username)
... {
var unlen = username.replace(/[^