|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14367
- 金币
- 2469
- 威望
- 1647
- 贡献
- 1417
|
这个脚本对你可能有帮助:
# N# N( K: J& e<script language="javascript"> * q1 s+ }0 _+ Y! H2 H! e0 P
function IsDigit(cCheck) 5 k1 N& H1 J" Z7 F/ F
{
6 m; a) ?, d4 [8 i return (('0'<=cCheck) && (cCheck<='9'));
( x1 O- h0 [9 B; m } 6 q5 F/ o1 b0 b' Q5 V
$ W! n0 P3 T/ l/ H3 P# s& Rfunction IsAlpha(cCheck)
6 g9 Y8 b* |0 W {
1 k0 p5 T+ V$ a* L7 c9 F. n4 V return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 7 |9 W! F8 D3 G2 G0 }0 q* ~1 B
} , H8 \3 U) V! I
0 z. r" h# K D) K" }( z0 h: Rfunction IsaNull(cCheck) 5 ?5 \& ^: O( n
{
$ d5 |1 t" g. a) p5 |; R return(cCheck != " ") / ]! L4 K8 z: Q
}
. V4 m' D, A6 y4 h1 v, N & }; B/ D# H3 h2 c E; a' O+ C
function checkform() 3 I$ ~8 |0 O2 @# ^ B b1 c# }
{ . s7 c8 f: p: ?2 r' U
id = document.sform1.id.value;
5 }1 R, w, v# Y6 w, s if (id == "") % t) I( B$ z! r9 J O
{ 5 Y8 o0 W% U; N9 A' u( }
alert("请输入注册名"); . \: @( R1 w) u4 V% @4 r; V1 Q
document.sform1.id.focus();
$ H" |. @. m( i+ u return false; 2 A' N/ ], g: L, J! T. i4 [/ n
}
0 L9 [3 L8 [5 L3 `3 T
I6 D" B) Z3 B for (nIndex=0; nIndex<id.length; nIndex++) p- ~4 o% a7 Q- g) F$ S
{ % \( `3 j) [3 k, Z. ^5 J
cCheck = id.charAt(nIndex);
; Q U8 p! A1 d6 G4 r u if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ( f7 R/ J$ F/ E% ]1 A# B1 k6 K
{
& s! S9 }" ~% L: g% m" }% b5 i. V) y9 c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : e3 N0 x8 W( u+ C6 ?) Z, G- U
document.sform1.id.focus();
5 ?7 H. s# e, m4 A$ l3 T; t# j) } return false; 4 ?2 q- u9 |$ f m* \1 m
}
/ _, P- t. n' X } ! V7 H4 }) d4 R$ q1 L, o' X
chineseid = document.sform1.chineseid.value; & j! L6 N' n/ G1 @3 s5 @
if (chineseid == "") 7 Y B+ p! j1 \/ Q* N$ ^
{ 6 }8 F/ O$ s( |; o9 C
alert("请输入中文昵称"); # y! i; X' o( R$ p8 v9 w$ K# E4 n
document.sform1.chineseid.focus(); & u0 F9 |& s$ V, n( a
return false; . E/ s7 x+ P% T$ R' r3 N
} . x, c. A5 C4 a8 i
password = document.sform1.password.value; 1 [% C3 p( [' o2 y* K
if (password == "")
- K3 b. O% ?" g7 I5 K1 B$ [ { / t3 y( ~% A4 a, a/ ^. p0 P9 _
alert("请输入登陆密码"); + ~) X5 ]; z: f. w& u
document.sform1.password.focus();
) Y2 ?; u$ O% z% F* n6 r# w6 ]; A return false;
+ h2 n( M+ H3 k3 X, k3 a1 W4 C }
$ `2 [; T0 z1 _( r+ ` password1 = document.sform1.password1.value; % p/ o1 k3 Q' f$ T2 @& ^2 I
if (password>password1)
, b; u8 U+ S! `2 ~1 | {
9 A$ M# {* z7 M- b$ l5 ]5 }6 U alert("重复密码与登陆密码不相同");
& Y- Y$ E. Q; Z document.sform1.password.focus(); % d: L: y/ ]9 m( x
document.sform1.password1.focus(); 9 X6 v* K- a2 U$ n. W6 w
return false;
$ I/ a1 H0 ~: P$ s+ w } " [" A; |3 u+ P, a; Q. s
if (password<password1) ! \* b* k& x/ p4 r3 u9 g
{
: p" r$ K" o3 a1 t# e, A6 p; f alert("重复密码与登陆密码不相同");
C; q ^) Q* M& x, C7 d( k document.sform1.password.focus(); ( F" z3 I' T7 z3 W- m; Z
document.sform1.password1.focus(); ! G3 g# M- m D+ x( x, ]) H- o
return false;( I2 t, z9 b2 F6 t, A8 |3 D* j
} / O/ ]( t3 ^, ~4 g* I4 E' V* T
if (document.sform1.email.value == "")
, e1 x ?5 y1 C% S6 P {
! P8 J$ [4 E1 J! C5 c alert("请输入您的E-MAIL地址"); , v) y# F9 l9 G
document.sform1.email.focus(); w- _6 ]5 b t! G: f# A8 c6 `) N
return false; 1 I- W- k5 J% A2 J1 n
}
9 s( [6 ~; Q. r9 f) F! M) X* E $ A- M: r' y# E
email=document.sform1.email.value;
1 ]; W/ j! \) M3 Z% } emailerr=0 7 d/ w# _2 `3 y; a P
for (i=0; i<email.length; i++) . j b! _5 _0 e7 k
{ & ?& W( g' W+ A8 ], R
if ((email.charAt(i) == "@") & (email.length > 5))
; {+ U" @+ K: k S4 Y; t) n# e {
2 d/ j! d# l3 \' d+ H% w; B) r emailerr=emailerr+1
, p6 n) E' ]+ }/ u } * V) Q* g8 N6 Q# X
}
) o5 {. X5 o2 j1 h/ f8 M if (emailerr != 1)
) V- `: Q# p8 s+ J! _. k- {) H8 b. { { + d; n$ C |8 C+ U" W$ x
alert("请输入正确的E-MAIL地址");
b" }7 Z. G& Q document.sform1.email.focus(); 9 A/ h7 _, e2 Y! ?/ u6 p
return false; ) [! c) `, G5 R6 b2 W4 D
}
( F6 J1 ?' t4 e: y& v
6 L- `9 F( |/ j) c" T" g+ S if (document.sform1.checkask.value=="") + @; Q, v# e$ B$ ]0 D
{ 6 J$ n7 B' \2 S2 w3 z) ]9 F
alert("密码提示问题不能为空");
1 h! `; F; s- m6 C/ A+ h# E4 D6 R; g document.sform1.checkask.focus(); " Z: S- [, P& R" t; B$ _
return false; / n( J7 q+ d* V7 V" H% |" d
}
& w3 G) Q, V% W/ |0 Q if (document.sform1.checkans.value=="")
- t0 X- N5 S! ]( p% B) A- P; R1 ?) M {
& A# ~% n) Q% r# O' _# s. j, K alert("您的密码提示问题答案不能为空"); & h* n1 D& p' R2 L+ a6 @
document.sform1.checkans.focus(); 5 R: {+ a. f2 O1 W6 Q& u
return false; " ~& W; ~* K+ ?$ A
}% C5 ], e" d$ Z8 a
return true;
7 ~9 ^3 h9 o2 X# ^- S! m5 w 1 y* b$ A4 r8 [. s5 b( F. | V: \- A) L
}
; W6 ?# f; I0 `' S" z. I9 d6 H0 V</script> |
|