您的位置:首页 > Web前端 > JavaScript

js 判断密码非连续数字

2015-12-26 14:44 471 查看
function
isContinuous(s) {
              
var
str = s.replace(/\d/g
,
function($0, pos) {
                  
return
parseInt($0)-pos;
[align=left]               });[/align]
              
if
(/^(\d)\1+$/
.test(str))
return false
// 顺增
[align=left]               [/align]
               str = s.replace(
/\d/g,
function($0, pos) {
                  
return
parseInt($0)+pos;
[align=left]               });[/align]
              
if
(/^(\d)\1+$/
.test(str))
return false
// 顺减
               return true
;
[align=left]           }[/align]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: