|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
这个脚本对你可能有帮助:
! ]0 j) Z: l7 ]* [' {+ U! G<script language="javascript"> - h/ o0 w: J7 J m
function IsDigit(cCheck) & x. s5 w# }3 S8 G; n) g- m
{ 2 j2 I& w6 R* S( s. r# r- H6 s$ ^
return (('0'<=cCheck) && (cCheck<='9'));
8 J, n) u: ` o, z( v. g }
% s- P0 n* R" [' t. f- P# a( B1 b 2 G; n2 Z0 H' f0 \% V p# J
function IsAlpha(cCheck) # G L! F9 k; q" g. q: X" L+ x
{
) Q7 s" p# t/ _" R return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 p, ~1 K9 K' M" M }
' l' y) P$ |# Y: H4 X: h
2 G6 H" F: P& mfunction IsaNull(cCheck) ; y! i8 y& Y) _8 t' r
{ & I# x; G+ ?9 D. Y4 F! {! C
return(cCheck != " ")
8 V7 y3 M( S. M/ Q* \0 O }
4 Q( M m3 l+ b. Z: D2 R+ Z5 L5 C e z
- k1 Q' Z+ u; E: Pfunction checkform()
) a% U& {4 A/ i{ ) [2 {9 p% k% _7 G4 u
id = document.sform1.id.value;
2 O. U. _- ~6 ~0 Q) Z- @/ J$ M if (id == "") 7 T! z4 `4 m# E5 ^4 f6 v9 }$ G
{
, u$ k" g% q* B6 W, ]! D O alert("请输入注册名"); & e0 `% N" e6 x: r
document.sform1.id.focus(); % `+ z$ k1 Z3 O: r8 d
return false; # l* h5 G: e* u. p. \
} 4 L- H) [6 Z. A8 O; t2 l
: c* h, Q5 L1 M1 {+ R for (nIndex=0; nIndex<id.length; nIndex++) 4 S6 N) k$ j3 ?" P6 k8 a! i
{
% |% u. \+ T/ [5 {" w cCheck = id.charAt(nIndex);
; T( y) @; g+ o; ^! y6 L" A if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) # ]( q' R$ u+ G) E* K" }9 |& x
{ " D# [6 G. c3 @7 x" Q5 a. Q
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
8 P4 [) N& v" F8 r* p9 G document.sform1.id.focus(); $ L* Y1 r/ x# u) {$ ]
return false; 5 x5 ?9 p- F. I/ {% g! n
}
V& E8 O8 L2 j4 p# b }
5 l' I; [) Q" L1 x chineseid = document.sform1.chineseid.value; ; Y0 C9 ~& H4 U6 ~0 ~
if (chineseid == "") 5 m$ F+ ^9 j0 L% P* E# ]
{
4 g+ d" {) T) l alert("请输入中文昵称");
& ]- ?5 ?) y6 `0 i/ x# [3 i document.sform1.chineseid.focus(); . }% i! g0 B1 B
return false; : n% E3 z& ]' E" S) Q, X
}
/ V* Z6 b" m+ Z& {+ r0 y1 U: \ password = document.sform1.password.value;
[- X; l- N% t# g0 E if (password == "")
- D* s# J& C, ~$ ] {
# F4 \) c4 F. ~! \ alert("请输入登陆密码");
& |) Z# l3 [+ u9 a- Y document.sform1.password.focus();
& |. T1 Q! g. v& A) E% D return false;
8 W7 t. `2 j- e- X } 7 H/ E! t4 p, O G) v \
password1 = document.sform1.password1.value; 6 u7 S) e1 X. b- h9 z9 I) Z8 M
if (password>password1)
% @: S% @# o% s- r {3 p( L: c+ d- K0 ]- g
alert("重复密码与登陆密码不相同"); ' b9 }0 e- b' @& L4 d3 d% y
document.sform1.password.focus();
/ L5 Y* S, k" Q4 {2 G document.sform1.password1.focus();
- D$ f- J* H/ P! M return false;0 ]# m- v. ]7 x% w- H+ b
} 6 D8 G/ M* J- X% W6 A5 @
if (password<password1)
$ K; O- G& e% U3 H/ s {
- @! l( T; r: f4 l# h/ O alert("重复密码与登陆密码不相同"); , M! |. f1 z, J
document.sform1.password.focus(); 7 w0 V6 ?$ v& c4 h9 H4 b( ]5 D
document.sform1.password1.focus();
2 y" @+ W. g) H* } return false; K7 v9 y+ B4 L/ H4 l, W; \
} 9 r8 V& J9 X* B$ Y& Q
if (document.sform1.email.value == "") $ h. S) y8 K7 b" s- H
{ 6 Y5 x' Q$ C3 I6 R
alert("请输入您的E-MAIL地址");
* j8 [" T! H5 O2 K% t8 h: E document.sform1.email.focus(); t" K6 h+ A" {; d; f) Z
return false;
0 e: h7 X5 _; M, ?, f' F } , K* [* |1 y Z: l6 v
& k, Z/ _! W# ^% {9 ^ email=document.sform1.email.value; : C9 x5 |$ k W1 B$ l: o
emailerr=0 # Z- U9 K9 L0 O" s. f
for (i=0; i<email.length; i++)
2 G: j. X6 j$ T& U. c# F7 P { ) K+ |3 H* U1 D5 a
if ((email.charAt(i) == "@") & (email.length > 5)) 2 u, b; ?7 | Y6 _* x; u$ L9 ?; h
{ 6 g* c% K) J$ W4 r! ^& P' [6 g
emailerr=emailerr+1 7 L/ A0 D7 H7 L/ _' o
} - U" M* O- o) a5 G
}
% e, Y0 ]6 u% k; m. ]+ W& q if (emailerr != 1)
5 i/ i& r1 i6 o! c { & y7 o6 U5 x9 Q0 g2 x
alert("请输入正确的E-MAIL地址"); 3 m* B# c+ u0 c6 I' H2 h) {
document.sform1.email.focus();
; f8 C+ ~/ K7 W2 @ S* r8 ^/ \- B return false; ( h7 p c) ^4 e. Z6 T3 l1 e
}
( B' Y* x f' \+ ~' F8 ? 9 R( Y/ y; \: d6 w8 Q& K* l/ d/ c
if (document.sform1.checkask.value=="") ; d: v9 k; x1 G4 x
{ + g. M. A2 J4 x
alert("密码提示问题不能为空"); 9 B6 t# j7 t9 G
document.sform1.checkask.focus();
6 [3 t9 t7 H' z2 a return false;
% Y L( r8 w% J. I: w4 Q) i }
) a6 R7 P0 }$ u- W# n2 N6 _ } if (document.sform1.checkans.value=="") ' n. U" v7 C( L# O: H# {, {: Z: z1 N
{ 5 U) D& Z$ x: t4 ~
alert("您的密码提示问题答案不能为空"); 9 r! k3 q" }! f$ m
document.sform1.checkans.focus(); 8 F" Y0 Y8 L3 d# h
return false;
0 r- [" W$ a' C9 W5 Q! u& k }( Y; ~$ [! f* P& e
return true; + X, ?0 h$ L m, ]
' O8 U" A7 V7 v; h' |3 m3 Y6 b}
; [4 O% a- `8 y- _' S; a; [! |</script> |
|