惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 小飞虫

遍历 Session,Cookie,Application JS获取URL参数值 - 小飞虫 - 博客园 PHP时间戳 Mysql 备注数据库脚本 gridview 为CommandArgument绑定行号 .net 3.5 属性简写 有效解决CSS兼容性的技巧 DropDownList绑定枚举类型 如何避免DropDownList绑定无效值时抛出异常 网上找的JS身份证验证,修复了一个日期验证的bug 几个js的正则表达式验证 通过javascript修改文本框内容后提交 正则表达表手机号码 修改成员管理默认的密码规则 js邮件地址验证脚本 asp.net 上传图片并生成缩略图 .net2.0邮件发送程序 从框架中关闭浏览器的JS脚本 关于web.config的问题
js密码验证
小飞虫 · 2007-01-10 · via 博客园 - 小飞虫

    <script language="javascript" type="text/javascript">

//程序设计:环球万维,专业提供虚拟主机,域名注册服务
//网址:http://www.netInter.cn
//本程序是环球万维原创程序,若需转载,请注明网址及出处,谢谢.
//以上信息与文章正文是不可分割的一部分,所以如果您要转载本文章,您必须保留以上信息.


//CharMode函数
//测试某个字符是属于哪一类.
function CharMode(iN){
 if (iN>=48 && iN <=57) //数字
  return 1;
 if (iN>=65 && iN <=90) //大写字母
  return 2;
 if (iN>=97 && iN <=122) //小写
  return 4;
 else
  return 8; //特殊字符
}

//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
 modes=0;
 for (i=0;i<4;i++){
  if (num & 1) modes++;
  num>>>=1;
 }
 return modes;
}

//checkStrong函数
//返回密码的强度级别

function checkStrong(sPW){
 if (sPW.length<=5)
  return 0;  //密码太短
 Modes=0;
 for (i=0;i<sPW.length;i++){
   //测试每一个字符的类别并统计一共有多少种模式.
  Modes|=CharMode(sPW.charCodeAt(i));
 }

 return bitTotal(Modes);
 
}

//pwStrength函数
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色

function pwStrength(pwd){
 O_color="#eeeeee";
 L_color="#FF0000";
 M_color="#FF9900";
 H_color="#33CC00";
 if (pwd==null||pwd==''){
  Lcolor=Mcolor=Hcolor=O_color;
 }
 else{
  S_level=checkStrong(pwd);
  switch(S_level)  {
   case 0:
    Lcolor=Mcolor=Hcolor=O_color;   
   case 1:
    Lcolor=L_color;
    Mcolor=Hcolor=O_color;
    break;
   case 2:
    Lcolor=Mcolor=M_color;
    Hcolor=O_color;
    break;
   default:
    Lcolor=Mcolor=Hcolor=H_color;
    }
  }
 
 document.getElementById("strength_L").style.background=Lcolor;
 document.getElementById("strength_M").style.background=Mcolor;
 document.getElementById("strength_H").style.background=Hcolor;
 return;
}
<body>
<form id="form1" action="userservice.aspx?Action=AddUser" method="post" onsubmit="return check()">
<input name="Pass" type="password" onKeyUp="pwStrength(this.value)" onBlur="pwStrength(this.value)" maxlength="20" id="Pass" />
</form>
<body>