|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14411
- 金币
- 2491
- 威望
- 1647
- 贡献
- 1439
|
这个脚本对你可能有帮助:
" q' ^7 `( C r/ H2 a- Y<script language="javascript">
% t- ]/ p& g/ X! B5 y% yfunction IsDigit(cCheck)
; B& A; g& m1 w, V { 9 T4 P$ h) }5 I" {8 v! D3 _& K/ m
return (('0'<=cCheck) && (cCheck<='9'));
" W8 {; t: P% F! C! e! \2 N }
( U8 ^) f3 i; E
, Z4 g, ?/ _7 X q: lfunction IsAlpha(cCheck) 6 D# ]8 ~6 r3 b/ [
{
$ \4 }& A8 R, A( z return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ; g4 Q9 u& J5 {+ |$ B$ y9 W
} % E) `# Z( q( V" n" M
: j r$ H6 m8 M+ D! V9 p# L
function IsaNull(cCheck) # B/ ^2 `# ^7 R$ E" U
{
6 w% A% l& j9 j0 Z' { return(cCheck != " ") ) ?% S- e7 [$ w& N* U( z. a. Q
} ' y' r( }) |3 [$ r, e ]
& @) n1 T0 r sfunction checkform()
1 f% }% q! n) c- Q{ & C+ t9 d; {1 H7 L
id = document.sform1.id.value; , |$ G/ p, E' n c# N
if (id == "")
8 K4 B8 K6 }& G. h7 c4 w% F! v {
# H& v ^( z0 [: z alert("请输入注册名");
; F0 \9 W( N/ w; S' } document.sform1.id.focus();
9 Z7 ?# S4 B, H& ]+ |; C return false; 1 d5 D1 v. t" i; F9 c3 r
} 0 p/ j8 e) Y- F3 {. ^3 \
" F! I4 Y7 L" w1 f" [( o1 B for (nIndex=0; nIndex<id.length; nIndex++)
6 \, Z# V2 h$ `4 `3 c {
b2 E( F; [) u* o' y cCheck = id.charAt(nIndex);
7 p3 }# I, ^3 Q+ A& v if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) $ [2 q9 f# V& K; a) G
{
- Q; f) I" D+ y$ D( _% p, H alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 0 W) Y6 f6 S$ o) Y ]# c
document.sform1.id.focus();
+ A1 u9 D9 ~$ D7 |0 Z1 t! [) g return false; ' Y/ }- n6 \! E2 W4 i+ f# i
} & u3 r6 N5 [7 i% M, R/ F
} % N! N& l+ l9 z4 ^0 w. d/ }) F
chineseid = document.sform1.chineseid.value;
4 k; i8 C: C+ f3 B d% F/ j; K2 a3 A- T if (chineseid == "")
# Q8 i7 W/ k, o/ z+ X | { + ^( Q; ?8 j- Q4 j" J
alert("请输入中文昵称");
8 j8 j4 X6 n6 T+ [ i" m6 I document.sform1.chineseid.focus();
0 f/ N! ~: L9 n% M! n return false; 3 k9 f. R# q/ N; p, }( e" g
}
/ Z4 l+ }4 [3 x! n password = document.sform1.password.value;
( N# N& L' h- V( V. G! G2 m if (password == "") 6 a3 y: n! b$ T1 p5 V' m. p
{ 2 G! [0 _6 A( v5 r4 J$ y
alert("请输入登陆密码");
! a- D% p3 O* ?& Z- b1 Y( u6 s document.sform1.password.focus(); ' [ Z' ]9 K& ]5 n. n$ p3 f
return false; $ j9 L1 X' M" q
} : P* h0 J) C/ ]7 l& g
password1 = document.sform1.password1.value; 3 }# |# b% |. S* G* l$ l' N" a
if (password>password1)
; O4 B% {9 [3 k9 U! }; a; Z {+ P( d! w3 j7 ~( x5 i
alert("重复密码与登陆密码不相同");
% D2 p+ s2 ~" W1 ]! o document.sform1.password.focus(); 0 \4 X( ^4 j/ }. A! q$ b% P
document.sform1.password1.focus();
; w& U# j b$ o# A$ E# d return false;
@( Z+ D. f2 y- W# r% h }
! j- B: W1 @8 Q* s' n( C9 d6 Uif (password<password1) # O% P! |" u) c: g; A+ q6 ?
{
9 Y& E- a- ?: p+ P" R ?" O alert("重复密码与登陆密码不相同"); + m, N& Z9 y" X
document.sform1.password.focus(); - }* C0 N3 ?# [) X
document.sform1.password1.focus();
9 \4 W( o. r) q5 ? return false;
0 o) s8 R7 A6 S$ P' | }
) B" X. U, i' ? if (document.sform1.email.value == "")
# O$ D+ t$ u- }1 O* }2 w+ J l {
# N: X6 J0 H* Y0 ~( I* \ alert("请输入您的E-MAIL地址"); 4 G; k. x: _1 O3 C. w6 z2 q
document.sform1.email.focus(); ; Y0 v% y$ Z4 L+ M4 O( v
return false; / Y$ e- h3 i u6 m; F: g) h
} + n& h4 F( y. Y3 D
* Q* N* @$ Z; z. g5 N' x* b
email=document.sform1.email.value; 3 l: j2 t& G6 S3 h# u- {
emailerr=0
( Z/ S1 r1 z) U2 R8 C for (i=0; i<email.length; i++) : h8 s& s' t w$ N2 i9 }
{ 5 R% a' x9 t( R% U
if ((email.charAt(i) == "@") & (email.length > 5))
B R1 a. E* s6 a9 s {
3 A m& K, I! \. C emailerr=emailerr+1 # V- |, a" }" x5 W( V, S+ b
}
& L0 ^* Z3 R q0 {# V6 v4 N }
& _$ ^, o$ c' N, X5 G* n0 c if (emailerr != 1) 1 j* k$ g9 `' y6 m% X5 b7 U
{ & B0 O* K) C7 V, t2 e2 E9 v# g+ b
alert("请输入正确的E-MAIL地址"); & s' p( s" v- ?4 y4 g8 a% p! ~
document.sform1.email.focus(); $ l% ^3 r; |& k! ]/ i; q
return false; , X0 u. |( d, k$ c3 {
} @+ D% ?/ k9 |7 D
; @8 z1 ]7 R4 s7 N+ p if (document.sform1.checkask.value=="") 7 ~3 e5 y* F; v8 J- f, o% |
{ $ }/ ?' A) [6 [ O
alert("密码提示问题不能为空"); % L+ g# n- ?7 T& U! }1 q; B
document.sform1.checkask.focus(); ; r# r8 y2 a2 M2 K8 S7 T
return false; + j3 s$ d+ U2 H
}
- _( E9 s2 [6 i: {7 B if (document.sform1.checkans.value=="") 0 ~% L* g. ] H: s! f4 c: }
{ : A4 r& o. _, J! f7 l6 j+ B1 o- m6 O
alert("您的密码提示问题答案不能为空"); 2 t6 e E0 f3 V9 F
document.sform1.checkans.focus(); 1 e0 i% H( |# `2 d5 i6 a3 k g; Q
return false; . ]. d2 e! Q4 q n
}
" c5 G' A* D: y9 n. }3 O. G1 z# p return true; ; E/ n8 S; }/ t
3 W* M& }! i' c1 ?% P: F} 0 s% N) i/ }: H* w/ P# r, w
</script> |
|