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
>
查看全文
相关阅读:
使用 python 提取照片中的手机信息
微信域名拦截检测接口2018版本
推荐几个Laravel 后台管理系统
微信小程序实例源码大全
微信开放平台开发-授权、全网发布(PHP)
微信公众平台开发者中心安全模式消息体加解密实现
微信开放平台搭建之EasyWeChat
详解微信开放平台第三方平台代小程序开发业务基本接口调用逻辑
EasyWeChat微信开放平台第三方平台接入
身边小程序:微信门店小程序给代理加盟商的红利有哪些?
原文地址:https://www.cnblogs.com/craig/p/1205845.html
最新文章
Weex学习系列
Android自定义View效果目录
Android8.0适配之一应用图标适配
在Android Studio中修改maven私库的地址
Jenkins+Gradle+Git+Pyger+二维码搭建Android自动打包平台
Android Studio3.0 Gradle相关配置
Error:Unable to tunnel through proxy. Proxy returns "HTTP/1.1 400 Bad Request"
Android LruCache原理
Android性能优化的一些建议
Weex系列-项目工程
热门文章
Weex系列-进阶
linux (IOT)防火墙开发
CUNIT 与 CPPUNIT 测试框架安装
华为jdk镜像
springboot 添加 Filter过滤
Mysql8 安装教程
第一个 JAVA WEB 应用
IDEA 社区版+Maven构建JAVA WEB应用
tkinter + cefpython 仿美团桌面程序
使用 Python 识别并提取图像中的文字
Copyright © 2011-2022 走看看