zoukankan
html css js c++ java
密码强度提示
<
html
>
<
head
>
<
style
>
body
{
}
{
/**/
/*
ie needs this
*/
margin
:
0px
;
padding
:
0px
;
/**/
/*
set global font settings
*/
font-size
:
10px
;
font-family
:
Tahoma,Verdana,Arial
;
}
a:hover
{
}
{
color
:
#fff
;
}
#user_registration
{
}
{
border
:
1px solid #cccccc
;
margin
:
auto auto
;
margin-top
:
100px
;
width
:
400px
;
}
#user_registration label
{
}
{
display
:
block
;
/**/
/*
block float the labels to left column, set a width
*/
float
:
left
;
width
:
70px
;
margin
:
0px 10px 0px 5px
;
text-align
:
right
;
line-height
:
1em
;
font-weight
:
bold
;
}
#user_registration input
{
}
{
width
:
250px
;
}
#user_registration p
{
}
{
clear
:
both
;
}
#submit
{
}
{
border
:
1px solid #cccccc
;
width
:
100px !important
;
margin
:
10px
;
}
h1
{
}
{
text-align
:
center
;
}
#passwordStrength
{
}
{
height
:
10px
;
display
:
block
;
float
:
left
;
}
.strength0
{
}
{
width
:
250px
;
background
:
#cccccc
;
}
.strength1
{
}
{
width
:
50px
;
background
:
#ff0000
;
}
.strength2
{
}
{
width
:
100px
;
background
:
#ff5f5f
;
}
.strength3
{
}
{
width
:
150px
;
background
:
#56e500
;
}
.strength4
{
}
{
background
:
#4dcd00
;
width
:
200px
;
}
.strength5
{
}
{
background
:
#399800
;
width
:
250px
;
}
</
style
>
</
style
>
<
script
>
function
passwordStrength(password)
{
var
desc
=
new
Array();
desc[
0
]
=
"
Very Weak
"
;
desc[
1
]
=
"
Weak
"
;
desc[
2
]
=
"
Better
"
;
desc[
3
]
=
"
Medium
"
;
desc[
4
]
=
"
Strong
"
;
desc[
5
]
=
"
Strongest
"
;
var
score
=
0
;
//
if password bigger than 6 give 1 point
if
(password.length
>
6
) score
++
;
//
if password has both lower and uppercase characters give 1 point
if
( ( password.match(
/
[a-z]
/
) )
&&
( password.match(
/
[A-Z]
/
) ) ) score
++
;
//
if password has at least one number give 1 point
if
(password.match(
/
\d+
/
)) score
++
;
//
if password has at least one special caracther give 1 point
if
( password.match(
/
.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]
/
) ) score
++
;
//
if password bigger than 12 give another 1 point
if
(password.length
>
12
) score
++
;
document.getElementById(
"
passwordDescription
"
).innerHTML
=
desc[score];
document.getElementById(
"
passwordStrength
"
).className
=
"
strength
"
+
score;
}
</
script
>
</
head
>
<
body
>
<
form
method
="post"
action
=""
id
="user_registration"
name
="user_registration"
>
<
p
><
h1
>
Password strength metter
</
h1
></
p
>
<
p
>
<
label
for
="pass"
>
Password
</
label
><
input
type
="password"
name
="pass"
id
="pass"
onkeyup
="passwordStrength(this.value)"
/>
</
p
>
<
p
>
<
label
for
="pass2"
>
Confirm Password
</
label
><
input
type
="password"
name
="pass2"
id
="pass2"
/>
</
p
>
<
p
>
<
label
for
="passwordStrength"
>
Password strength
</
label
>
<
div
id
="passwordDescription"
>
Password not entered
</
div
>
<
div
id
="passwordStrength"
class
="strength0"
></
div
>
</
p
>
<
p
>
<
input
type
="submit"
name
="submit"
id
="submit"
value
="Register"
>
</
p
>
</
form
>
</
body
>
</
html
>
查看全文
相关阅读:
PCA本质和SVD
特征工程(转载)
python入门基础代码
长尾理论
金融行业数据分析
[rancher-net]
rancher中使用ingress-lbs做负载均衡
python 高级语言特性
docker从初识到深入
关于容器技术的发展以及虚拟化技术的总结
原文地址:https://www.cnblogs.com/craig/p/1205845.html
最新文章
总结的一些网站利于搜索引擎优化的小常识及SEO优化
整理CSS引发的相关理论的梳理
高性能JavaScript(您值得一看)
用css3实现各种图标效果(2)
用css3实现各种图标效果(1)
总结jQuery选择器
我所了解的chrome
《代码大全》阅读笔记-4-关键的“构建”决策
《代码大全》阅读笔记-3-三思而后行:前期准备
《代码大全》阅读笔记-2-用隐喻来更充分地理解软件开发
热门文章
《代码大全》阅读笔记-1-欢迎进入软件构建的世界
字符画生成工具
Linux性能监控命令——sar
Python实现字符串反转的几种方法
Python并行编程的几个要点
近段时间面试总结
神经网络(1)
决策树与随机森林
聚类算法
逻辑回归LR
Copyright © 2011-2022 走看看