|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:
( s5 I, V H% S<script language="javascript">
- P. _/ \9 h: j3 F. O5 `2 Gfunction IsDigit(cCheck)
% v5 c: v+ _! G" B { 1 d# K8 C. d9 R7 H: r$ D5 s
return (('0'<=cCheck) && (cCheck<='9'));
# B. p: H" s5 T1 { } " W8 E& _+ m" d! H; M
0 ~3 D9 o/ K/ B: L1 V/ Z- A
function IsAlpha(cCheck) 4 N# t1 g. x1 C4 P, j+ z( x) l
{ ' C6 U v1 F/ d" f& L2 {7 Z7 }+ e" [
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
4 T N$ F. g1 x# B1 T } & B( W1 B, e: l: D$ U4 }& H
0 T" D( n, f% I/ d, nfunction IsaNull(cCheck) 5 L* D- y) V/ y+ F9 F- `7 j7 q
{
6 i- |+ m; x3 k0 ] return(cCheck != " ") : A2 n2 K: o% b# @
}
8 o: r7 T5 Q3 P. ?% {
) q; r5 ?7 |, t5 Ufunction checkform()
* h5 X) @4 k; {% |# n1 R+ [3 `{ . E0 H9 S* ]2 |& U' F/ m# _
id = document.sform1.id.value;
+ L. O- F% i. K7 |7 I) p, w if (id == "")
- j, D: B2 h, c: x5 P { ! ]9 Y3 s( A3 |- V
alert("请输入注册名"); 5 U% n# `6 d2 E
document.sform1.id.focus();
6 W6 s5 S# J2 c% Y/ P! N return false; 7 N" y, o/ v% |
} , N8 B: l H4 n/ T
5 r: Z7 ^3 h& ~3 S% [1 v7 ? s
for (nIndex=0; nIndex<id.length; nIndex++)
# R; y. `: G6 ]0 |; R- a. P { 6 E' i( x3 x7 s) p# w" E8 b- }; }
cCheck = id.charAt(nIndex);
8 D9 T+ q) y7 C) w if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ' H; X O9 I' N8 |! T, M
{
3 m @( z( a' A: C6 f9 t! h alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' b. W. O) S% H, P \
document.sform1.id.focus();
5 c e+ Q, D4 o, t% q+ A return false;
- W, q s9 N: {. \ } } . _$ K5 n ]; U) P; T
} 4 e1 H( M; }' E
chineseid = document.sform1.chineseid.value; $ m8 \8 R" U$ a# N/ I: ^4 ^
if (chineseid == "")
) X% G& u4 ?8 ^0 C; o- r { 6 u* g+ O1 [ O3 F
alert("请输入中文昵称"); / r; Z, ~: P. H/ @/ D& `( r
document.sform1.chineseid.focus(); , m/ H4 ~& `$ _/ W6 a
return false;
/ `% u/ n3 u3 E* v) E& t } / o7 j0 r G: ^
password = document.sform1.password.value; - U T7 g! F: k. H. `+ S: R8 g
if (password == "") , N2 v3 F8 k% F# e: J$ c
{ ' U9 V& H! L5 Z! D1 ?
alert("请输入登陆密码");
7 Z) E7 ?2 w8 i+ ~* C% T) O, h document.sform1.password.focus(); * t# z& H8 [0 D% e! A% R
return false;
+ Q0 ]. S3 i! _, y }
& R1 p9 x. m! J; y! \$ C password1 = document.sform1.password1.value;
# I' X7 P f) M& o! e# @ if (password>password1) 1 ^3 H( K$ O$ G" x, C
{0 }0 D+ O) c- ~6 t
alert("重复密码与登陆密码不相同"); ! v0 {7 Z% B4 ^5 }$ X& e" p
document.sform1.password.focus(); / Y0 X1 T# R7 r; G
document.sform1.password1.focus(); & w% o) j9 I5 s, n9 ^
return false;: Q8 A. n6 N$ k% n
}
D" U& B* ^8 U+ j9 sif (password<password1)
- o5 J+ ?5 d( r, }& E8 z {
6 `- v) e! b {) u alert("重复密码与登陆密码不相同"); 9 F5 y) s* F1 E
document.sform1.password.focus();
8 I* f6 m1 b5 B/ V, B8 @7 y7 J document.sform1.password1.focus(); 1 l2 Z1 U7 Q5 ]. W
return false;$ C& \& |1 Z: z
} 0 H- u, H* v+ R Q
if (document.sform1.email.value == "") 0 q9 a A6 O0 c7 T$ @% h* B
{
/ g! z& Y8 i, F9 l# a# G/ d0 P& K' H3 M alert("请输入您的E-MAIL地址");
# n0 P" P5 Q; F% [/ L! L document.sform1.email.focus();
2 a: h3 T% ?, I' @ return false; , g8 M1 K9 _! d
}
& u$ s4 y2 p8 i 1 x2 I9 G0 b( Q3 O( L* `
email=document.sform1.email.value;
* \/ J3 _9 U5 u% Q& G; E1 h+ V! ` emailerr=0
9 }) f0 ?# x& w7 C+ \; c for (i=0; i<email.length; i++) 3 s7 ?4 L4 \( R" k! U
{
e/ K5 A0 M& b' F if ((email.charAt(i) == "@") & (email.length > 5))
* m' m. D1 F6 \/ P- `1 x! d. F& [ {
R% H+ Y9 R- |9 f, @2 t: Q# j emailerr=emailerr+1
7 K0 M7 n/ a0 V0 n4 J4 J7 l } , T g: K0 [: U; f
}
1 _: Y2 K. R+ m8 I if (emailerr != 1)
* V/ K( @4 u4 m$ w9 U% T+ S/ N2 e1 C {
# l' W3 f! w3 `! e2 Z alert("请输入正确的E-MAIL地址");
+ _3 a% L$ S) t1 s document.sform1.email.focus(); + |* s2 ~8 j3 U2 y7 V
return false; , }2 }: o, g( _
}
8 _7 a! ^# t r- h9 _( ] ; ` e- T, i/ O2 ^
if (document.sform1.checkask.value=="")
" C+ G+ d6 a, X {
1 o/ Q" r2 I' r w alert("密码提示问题不能为空");
8 o4 n; t: `6 ?5 ~4 ?3 h document.sform1.checkask.focus(); * ^ @% @$ G" X- a. A; C
return false;
7 }9 A) P! i/ u& Z* ] M } / `1 B! t5 f! h, y; b/ j/ L, B
if (document.sform1.checkans.value=="")
0 Z1 a0 N+ P# c0 r% k. K9 J" v { 7 N/ O( Z% E7 M4 W0 z
alert("您的密码提示问题答案不能为空"); 0 I7 y& u. X$ M# o0 @! k, }8 {
document.sform1.checkans.focus(); # N7 P4 w% }0 ?, |4 {2 t) p
return false;
' z5 n1 x3 Z7 N! O, A }
& e. f( C6 g+ C, D( N% X) Q return true; 5 i& ]8 B D7 _9 q4 Y: R h
1 e1 O1 s7 X$ i+ b4 Z}
) h% B5 A* `+ k2 r7 q0 y</script> |
|