顯示密碼的安全性提示
来源:互联网 发布:第七次人口普查数据 编辑:程序博客网 时间:2024/05/13 11:23
<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(/[^
- 顯示密碼的安全性提示
- 关于 PHP 表单安全性的重要提示
- 提升 MongoDB 安全性的 10 个提示
- 关于 PHP 表单安全性的重要提示
- 有关在代码中查找安全性缺陷的专家提示
- Office 2010 取消弹出宏安全性设置错误的提示的技巧
- 【OFFICE】Office 2010 取消弹出宏安全性设置错误的提示的技巧
- 系统自动更新提示安装MSXML 4.0 SP2安全性(kb936181)的解决办法
- 使你的ActiveX控件执行时不弹出安全性提示
- Microsoft Office 2010 取消弹出宏安全性设置错误的提示
- 使你的ActiveX控件执行时不弹出安全性提示
- (error/warning)java Unsafe等改变安全性的类怎样去掉eclipse错误提示
- 增强Web的安全性
- WebService 安全性的讨论
- WebService 安全性的讨论
- 网站的安全性
- pppoe的安全性?
- 保护 Portmap 的安全性
- 如何把一个页面中textbox的值传给另一个页面中的textbox
- session机制(转)
- 注冊時,控制協議點同意按鈕的時間
- 随机抽取不重复ID
- IBM ThinkPad 硬盘的分区处理!
- 顯示密碼的安全性提示
- ubuntu安装flash--成功
- 在线《ExtJS2.0实用简明教程》
- Trac 手记(一) : Windows 下安装 Trac
- 多线程开发学习笔记之线程同步——事件
- 大家发表发表意见-电科网
- 用VIM编写C/C++程序
- 研究证实女性做九项运动可提升思维能力
- 解决使用MyEclise6.0的快捷键ALT+/不好用的方法