|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
这个脚本对你可能有帮助:
1 Z- n( W2 {6 W* _<script language="javascript"> 8 }9 G% s# \) \) n+ _0 x
function IsDigit(cCheck) ' x# t/ H$ l, ^4 |
{ 1 d T3 G; c) _9 V8 |, F+ E
return (('0'<=cCheck) && (cCheck<='9')); ) _) Y2 u: x& x$ O% V) O3 J$ N
}
- i$ r1 a3 _9 O+ C3 r F' g6 J/ e 5 r+ ?( _: o8 I) d
function IsAlpha(cCheck)
! V- s0 U& _& D- v# ~ {
$ \1 Q* e( Z' _/ q/ G return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% e( J+ {2 D( L! y A( j$ m9 f }
1 [/ {$ R' y9 w/ K$ g
4 ]7 D' v4 a2 J# ~: sfunction IsaNull(cCheck) ) a* B+ @6 `2 `- q. R3 b9 [
{ * A& F1 i- _( `1 ]
return(cCheck != " ")
1 g% C c! C z' K+ B. f+ l) }' Z }
8 [) G4 R1 C, P' e3 K
# [% o. p$ ~. z! r5 @function checkform() ) ?9 l. h/ Y" H4 p. Y
{ & |* p& p6 g" U% R8 a4 t p3 j
id = document.sform1.id.value;
$ W* ~ ]6 R% o" x- @) S- e if (id == "")
9 h% V+ q$ u6 C3 d* l( I {
4 ~ a; c% b9 Q0 w% ?' x3 Z alert("请输入注册名");
0 ^. ^6 m, ?$ [) | document.sform1.id.focus(); 5 v& L. a" Q7 m! R6 M% j
return false; ! u* v, e/ A' K+ S
}
" q- \5 s9 g% M, }* I" v; ]; Y9 t3 I : o4 m& x0 z1 v! X
for (nIndex=0; nIndex<id.length; nIndex++)
& M% O8 e$ U: b" H( k {
* `6 M- f3 n, x# t5 H& T cCheck = id.charAt(nIndex); 1 v( P X3 j1 H% I0 R, r/ m' @
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) . ] P/ t1 l( B: q: G* m
{ ( k/ k! n2 E3 l& W! k& { R
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
% W _, e+ O# u$ N$ Y! h; M H document.sform1.id.focus(); 3 Z8 _7 w6 r) l- s* J5 f
return false;
2 T; A: `2 w/ I+ s* e* c" ` } 6 @ p2 n6 M* G% n- d# [
} ! {1 ?0 x# h1 [ U0 v
chineseid = document.sform1.chineseid.value; ) @: G9 p5 M2 `5 f9 K1 Q
if (chineseid == "")
( C+ y- r. W ?* ]' Z$ S: c4 `6 d { : R' B+ i- ?+ L8 {
alert("请输入中文昵称");
A8 m1 ^( j8 a& N# Q; }! j" P% k document.sform1.chineseid.focus(); 5 [( |( F7 r6 R" U
return false;
4 m, A8 C+ k4 \# j0 X! H }
6 x9 r$ k4 t2 m- _9 C) t. T0 }& g password = document.sform1.password.value;
4 Q* A9 E: C% ^ if (password == "")
% ^) J# V4 _4 W1 {/ w4 I { 7 M" A! _: b$ [& E
alert("请输入登陆密码");
, t; G1 u) R4 w$ V) M4 Y7 W document.sform1.password.focus();
% g% e9 ~& y" R* s: q9 L0 s return false; # \- i; e( v2 K2 O/ w* s
}
$ p1 V! ?9 Z4 }3 ^ N3 F: T( T password1 = document.sform1.password1.value;
! g2 S/ q3 A. ~9 {. t if (password>password1) 2 Z0 z( u* h5 B. E
{ i k; \& j( ~- W9 f. c/ M3 b8 f
alert("重复密码与登陆密码不相同"); + `" a. I; E7 J8 w
document.sform1.password.focus();
" Z6 g8 z( N( d3 ^ s: Q document.sform1.password1.focus(); 0 ?! C& A- ]* {
return false;
8 v( |! o2 l- \% R9 s& ?! @ } 0 p r0 X6 ~: S
if (password<password1)
8 W$ y' t: `& v& S; X0 B {
, f! y/ c) A: p }: g3 D& T' v alert("重复密码与登陆密码不相同"); # g6 H% j4 m# ?( ~* N8 X" q& e
document.sform1.password.focus();
5 W8 W$ j+ z" U7 ~6 J& W5 d document.sform1.password1.focus();
+ A) R9 A8 L; H( r! B return false;
& N6 S8 h2 z5 p1 s/ W- r } 8 z5 f0 C+ Y4 N3 i: r Q
if (document.sform1.email.value == "") - {( D- Z$ @. D
{
0 r* _( ` {( Z# L' _# B' m' Y/ O alert("请输入您的E-MAIL地址"); U7 y% ?( c5 {, f
document.sform1.email.focus();
: g7 M! Y9 S) F) V6 n, O/ g return false; & J' x$ M* F" x4 V6 c
} 4 H" P5 _- c6 u; x4 N
' O- d8 R# X' U7 `2 ]" P
email=document.sform1.email.value;
7 ?) z' S2 F, F+ `* N0 g emailerr=0
/ L/ |0 N4 D0 G0 c7 x2 n5 m h for (i=0; i<email.length; i++)
8 i8 r! Z5 O0 ^# W( t0 T { 1 W: N. ?( i/ D' X
if ((email.charAt(i) == "@") & (email.length > 5))
4 Y+ _7 o* U- z! L; e8 k {
% C: z- G) {9 j- E+ L) K3 F5 \* ?0 Z emailerr=emailerr+1 & I6 q. r# B( D8 c4 F. w: I0 O
} ; z! C H/ t7 i. \8 O
} ' i4 Y% k3 [. b: h
if (emailerr != 1) 5 w; F% r, w8 ^5 l; @+ E
{
1 Z2 d3 |+ x, E3 t2 Q( C alert("请输入正确的E-MAIL地址");
8 W3 g( ?- S' b( C* Z. q document.sform1.email.focus(); 2 ~; @$ y' ^# v' G6 K% u1 b
return false;
4 t9 t2 I/ i- ?7 D5 \ } 5 A( S2 n) ^% P$ g/ M; e
% A; t# m% R/ |. b# n X# Z) j; `
if (document.sform1.checkask.value=="") 1 t7 {# T- u" \* d1 R7 [6 E
{ + D, u, G3 G& F- y. M8 e0 K# B9 e
alert("密码提示问题不能为空");
3 u. W2 s: Y, R" g document.sform1.checkask.focus(); + v2 z2 h3 p& Z
return false;
* c' i: h2 D' |9 @+ C } 2 O$ \% @! M6 }, e! R" d2 u% E
if (document.sform1.checkans.value=="")
6 z' G$ U5 u0 K. U2 r% a {
. Z' \9 Q8 y0 _/ m/ W! D alert("您的密码提示问题答案不能为空"); 2 g4 r2 }7 r# A9 r1 c( G8 T
document.sform1.checkans.focus(); / b/ s* q( C; d& G; Y7 A* X
return false; 3 j# R8 a: p3 d4 K7 e) S3 S( _" h
}
7 L5 m7 N" x7 T0 a. Q, i$ Z7 V+ n return true; 3 s" } p0 X' g) o; {# P
9 P* X: q9 a" ~% g. W! F A0 ?
} ( S( F5 q H$ ?& l0 p
</script> |
|