js 验证非常好_转
http://justshare.iteye.com/blog/226479
?
-
??
-
????function?getEvent()?{??
-
????????if
(document.all)???
-
????????????return
?window.event;?
??
-
????????func=getEvent.caller;??
-
????????while
(func!=
null
)?{??
-
????????????var?arg0=func.arguments[0
];
??
-
????????????if
(arg0)?{??
-
????????????????if
((arg0.constructor==Event?||?arg0.constructor?==MouseEvent)?||?(typeof(arg0)==
"object"
?&&?arg0.preventDefault?&&?arg0.stopPropagation))?{??
-
????????????????????return
?arg0;??
-
????????????????}?????????????
-
????????????}??
-
????????????func=func.caller;??
-
????????}??
-
????????return
?
null
;??
-
????}??
-
????
??
-
????function?LTrim(str)?????
-
????{?????
-
?????return
?str.replace(/^\s*/g,
""
);?????
-
????}??????
-
????????
-
????
??
-
????function?RTrim(str)?????
-
????{?????
-
????return
?str.replace(/\s*$/g,
""
);?????
-
????}?????
-
???????
-
???
??
-
???function?trim(str)?????
-
???{?????
-
????return
?str.replace(/(^\s*)|(\s*$)/g,?
""
);??????
-
???}?????
-
??????
-
??
??
-
???function?CTim(str)?????
-
???{?????
-
????return
?str.replace(/\s/g,
''
);?????
-
???}?????
-
??????
-
???
??
-
???function?is_digitals(str)?????
-
??{?????
-
????var?reg=/^[0
-
9
]*$/;
??
-
???return
?reg.test(str);???????????
-
???}?????
-
???????
-
???
??
-
???fun