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
>
查看全文
相关阅读:
用户管理
网线制作与分类
5.虚函数,覆盖,多态,异常处理
4.类的继承
3.运算符重载
7.STL
6.泛型编程与模板
C++中>>,<<的重载问题
2.名字空间和构造函数
1.C和C++的区别
原文地址:https://www.cnblogs.com/craig/p/1205845.html
最新文章
常见知识点总结
Spring的beanFactory与ApplicationContext区别
安卓ios适配问题汇总
php导出csv报表
h5页面拉起手机内的APP
关于react-redux中的connect函数
react后台开发框架搭建
provisional headers are shown 错误原因
禁止将http请求强制转换为https请求
移动端适配方案
热门文章
webpack打包优化之react-router路由分割
webpack自动生成页面
cobbler自动化部署
NTP服务和DNS服务
NFS服务和DHCP服务
rpm和yum软件管理
网络管理及进程
磁盘管理及lvm
权限管理
vim编辑器
Copyright © 2011-2022 走看看