js正则表达式注册页面表单验证

阅读: 评论:0

2024年2月8日发(作者:)

js正则表达式注册页面表单验证

Limit : "(,getAttribute('min'), getAttribute('max'))",

LimitB : "((value), getAttribute('min'), getAttribute('max'))",

Date : "(value, getAttribute('min'), getAttribute('format'))",

Repeat : "value == mentsByName(getAttribute('to'))[0].value",

Range : "getAttribute('min') < (value|0) && (value|0) < getAttribute('max')",

Compare : "e(value,getAttribute('operator'),getAttribute('to'))",

Custom : "(value, getAttribute('regexp'))",

Group : "ecked(getAttribute('name'), getAttribute('min'), getAttribute('max'))",

ErrorItem : [[0]],

ErrorMessage : ["以下原因导致提交失败:tttt"],

Validate : function(theForm, mode){

var obj = theForm || ment;

var count = ;

= 1;

= 1;

tem[0] = obj;

for(var i=0;i

with(ts[i]){

var _dataType = getAttribute("dataType");

if(typeof(_dataType) == "object" || typeof(this[_dataType]) == "undefined") continue;

tate(ts[i]);

if(getAttribute("require") == "false" && value == "") continue;

switch(_dataType){

case "IdCard" :

case "Date" :

case "Repeat" :

case "Range" :

case "Compare" :

case "Custom" :

case "Group" :

case "Limit" :

case "LimitB" :

case "SafeString" :

case "Filter" :

if(!eval(this[_dataType])) {

or(i, getAttribute("msg"));

}

break;

default :

if(!this[_dataType].test(value)){

or(i, getAttribute("msg"));

}

break;

}

}

}

if( > 1){

modemode = mode || 1;

var errCount = ;

switch(mode){

case 2 :

for(var i=1;i

tem[i]. = "red";

case 1 :

alert(("n"));

tem[1].focus();

break;

case 3 :

for(var i=1;i

try{

var span = Element("SPAN");

= "__ErrorMessagePanel";

= "red";

tem[i].Child(span);

TML = essage[i].replace(/d+:/,"*");

}

catch(e){alert(ption);}

}

tem[1].focus();

break;

default :

alert(("n"));

break;

}

return false;

}

return true;

},

limit : function(len,min, max){

minmin = min || 0;

maxmax = max || _VALUE;

return min <= len && len <= max;

},

LenB : function(str){

return e(/[^ 00- ff]/g,"**").length;

},

ClearState : function(elem){

with(elem){

if( == "red")

= "";

var lastNode = odes[-1];

if( == "__ErrorMessagePanel")

Child(lastNode);

}

},

AddError : function(index, str){

tem[] = tem[0].elements[index];

essage[] = + ":" + str;

},

Exec : function(op, reg){

return new RegExp(reg,"g").test(op);

},

compare : function(op1,operator,op2){

switch (operator) {

case "NotEqual":

return (op1 != op2);

case "GreaterThan":

return (op1 > op2);

case "GreaterThanEqual":

return (op1 >= op2);

case "LessThan":

return (op1 < op2);

case "LessThanEqual":

return (op1 <= op2);

default:

return (op1 == op2);

}

},

MustChecked : function(name, min, max){

var groups = mentsByName(name);

var hasChecked = 0;

minmin = min || 1;

maxmax = max || ;

js正则表达式注册页面表单验证

本文发布于:2024-02-08 19:35:36,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170739213668338.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:验证   提交   页面
留言与评论(共有 0 条评论)
   
验证码:
排行榜

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23