|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14385
- 金币
- 2478
- 威望
- 1647
- 贡献
- 1426
|
这个脚本对你可能有帮助:
4 G* J. o6 M. A# _ v0 B! `<script language="javascript">
) f# a+ _: y% V+ tfunction IsDigit(cCheck) + D0 e0 p* b) }0 u' B+ o0 Z
{ 8 d6 `% X% M' i. H, ?0 P
return (('0'<=cCheck) && (cCheck<='9')); & F# F% d# h5 t/ e
}
4 @- I8 q" m% [ L) }0 z 5 {" ?/ l' V9 n9 R* q l2 ~
function IsAlpha(cCheck) 6 x( J) A- Y4 W$ Z& a
{ - j2 `. _: a. y9 o- W, t, A
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 X7 R7 a7 V/ ]! C- q- Z8 i }
% x- f( b& W0 O+ ~; r9 j0 ]
* K7 x4 \6 u8 E3 \9 C5 tfunction IsaNull(cCheck)
( x- g1 E+ p! r* Y7 k {
) T/ c4 l" ^* K% F return(cCheck != " ") - ^" |; H+ Q, m K. F, P
}
% {, b* ^) I+ i. ^' ?
" Q3 e4 w \4 u' }3 Bfunction checkform() - U1 u) i* E. W. `' {. d
{ ( ~! W. K" l, ~, e$ R
id = document.sform1.id.value; ; \# D( _: Q' C/ b
if (id == "") 6 G1 G" t1 |0 f2 Q; {
{ * @5 r6 Q' g" b7 `! i- Q/ V V
alert("请输入注册名"); - y( z' S c2 ~& R
document.sform1.id.focus(); ' |8 g1 g D) `3 S5 r
return false;
. H* C6 l8 U" |* M }
0 h' P: a5 U- v. }7 X
/ B9 A" r2 @: T- d8 L, u! G* B H for (nIndex=0; nIndex<id.length; nIndex++)
% m* C( {$ B: l. D { : X- q! V( ], l5 S- u) Y
cCheck = id.charAt(nIndex);
) ~5 E6 I4 m u. A/ N. ? if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% ~# S. ]2 A/ ]7 `. [, J5 s- b { 5 k$ l; m6 V# }4 B' |% L
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
; Z/ X# Z1 k' G" R% F) Z document.sform1.id.focus(); 7 F. E; Z1 A: T
return false;
2 N) K2 g( B% e7 `4 T) E4 o: ?& g4 P }
4 ?- F! }. O( C' f$ ] } & g g' w6 @; y& ]' T: ^5 d& V
chineseid = document.sform1.chineseid.value; ) n# j4 y% t+ R( I% x: l) @
if (chineseid == "")
- u" G; _: p" a, ?3 }' g { ! C6 t9 Z8 B4 j8 j0 I* v3 {
alert("请输入中文昵称");
) M! i5 H& T @& } document.sform1.chineseid.focus();
5 [- b$ c6 b+ P+ `% t# U return false;
/ w* e) j( H' h1 e# T- Z; N( ` }
" z9 D5 o8 \: r, C6 ^ password = document.sform1.password.value;
~: G4 A; W8 K) p& D0 U* b if (password == "") @8 D7 H& I" F5 ]
{
2 S# D% j. Q N L ?7 e0 ?; }4 ? alert("请输入登陆密码"); 4 k8 ^$ K1 y b& K/ B% E' P
document.sform1.password.focus();
( C1 c, k! J7 Z+ u return false; 5 i2 T; V1 ]( |- O6 C# m
}
/ a8 Q. y6 s% V2 ?- A9 r password1 = document.sform1.password1.value;
4 ^( Y% G% M' @4 ?) t/ y if (password>password1)
M' R+ f Y0 W0 I$ Z8 ~ {) j! O) I7 d. \3 u
alert("重复密码与登陆密码不相同"); $ g1 a' }: o$ G8 ^
document.sform1.password.focus(); 1 W, b& m4 u5 A1 L
document.sform1.password1.focus();
7 ^* K6 d# `- M3 D return false;
7 h, j2 L* G3 p1 @% }# _ } & Y2 E3 d" i5 {4 {+ L9 j. }
if (password<password1) $ e$ X- l2 B' @; W' s9 n- P
{. d6 a0 g0 @, H& S
alert("重复密码与登陆密码不相同");
# T8 I& S3 g, A document.sform1.password.focus();
. m. X6 b/ T( h+ x6 \# C# e. l document.sform1.password1.focus();
" d$ B: H6 \% y) Q1 ?8 l return false;
# N, p% u/ k' p/ L& B }
. g& T1 e' l/ I6 c1 m* v* } if (document.sform1.email.value == "")
; f# q* U& j! L9 ~: \ {
% `2 C8 T7 A+ b3 B5 ~- v alert("请输入您的E-MAIL地址"); ( N: m y/ D& e- w
document.sform1.email.focus();
6 X j4 c1 I& H/ W return false; 9 b0 n. g4 v; U8 A
}
, c/ |$ ]" P! Z8 s ! c* ]2 y( y% z6 E+ c
email=document.sform1.email.value;
1 `; d" u+ [" ]' ^0 C9 x$ x9 ^- [ emailerr=0 / s" N0 z5 ~- T) b
for (i=0; i<email.length; i++)
! w' O; T8 f8 m% d) [, a6 g3 [! b {
8 a! @5 l. m& Q8 F$ Y" `$ ] if ((email.charAt(i) == "@") & (email.length > 5)) " [! M' H; O. g
{ 0 Z7 x; O( h" ~3 S, O
emailerr=emailerr+1 ' Q- }: I6 F) ^7 \. w
} # l: Y4 l+ T. g- Z5 |& c$ G( ]
} " P; S$ O, C H5 v+ y% k1 e
if (emailerr != 1)
& j3 L# y, Q+ i' ~# [9 M {
9 m3 m7 c" E) [) p* b alert("请输入正确的E-MAIL地址");
) W5 G3 J" i( ~; G2 z document.sform1.email.focus(); ; F" |# @1 ^" N, j( h8 _; }
return false; * Y" T7 `# l+ g D1 d) W% o: ^) z
}
$ y0 H8 @. F2 e% W4 V
" @. ~3 F1 e% m, \' i9 X if (document.sform1.checkask.value=="")
& b* P) F" B2 Y% Z% F {
& z1 K3 y/ M9 k) M alert("密码提示问题不能为空"); ( ?/ }9 b7 I8 U* Q# M2 J3 d
document.sform1.checkask.focus(); : E& f4 m6 I" s, k7 ?8 L
return false; ; H( m6 C8 x! F' E
}
$ W3 V6 _" C+ b4 a J ?* \ if (document.sform1.checkans.value=="") D6 }4 I- A' a& m# @ C8 J
{ }0 }1 f6 Q( b6 `0 z1 H
alert("您的密码提示问题答案不能为空");
w4 O" ^1 L Y9 C; F; R document.sform1.checkans.focus();
( a( ^- [7 u8 m0 _1 ^- w8 G0 _& ~ return false; 0 l! s1 f4 d/ k6 E* Q8 D J
}1 _; G# n9 L. [( N0 b: I
return true;
) p, |; n8 t, d7 m, G
0 r, G0 k2 q" @}
9 u" Q' V) h$ T, R( P</script> |
|