|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14421
- 金币
- 2496
- 威望
- 1647
- 贡献
- 1444
|
这个脚本对你可能有帮助:
, Y3 f. S7 n& D, B<script language="javascript"> ! w( q6 g! x4 q
function IsDigit(cCheck)
" m3 V2 g# b. _5 s. e4 P" G {
4 G4 F3 H3 m9 l$ b, ~% P return (('0'<=cCheck) && (cCheck<='9')); $ O g' N/ f7 G4 |1 {; `
}
; D- v# }/ b8 ?3 g( M9 e + j+ u3 u8 |; b5 L+ s- f6 \
function IsAlpha(cCheck) 9 ^- |9 F+ n5 D9 X
{ 2 q1 I# a6 q+ |/ j
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 L, t1 s& X. y0 H. N } & m; \# k5 R4 ~% a! q% O
) d% n7 f6 E* Z1 Q6 q- Y% }% kfunction IsaNull(cCheck)
6 p( A' \! ~2 X/ M7 y { " x0 |; N. v' @6 Z7 ^1 _: U
return(cCheck != " ")
' H( J0 ~6 o, n( D2 u2 i5 n } 4 a5 @3 }8 U) A* b& V
8 g3 S* @3 _( c0 _5 w9 Yfunction checkform()
' t" e f0 u. s; M5 U{ : k* ]4 H6 M9 n4 F$ M
id = document.sform1.id.value;
8 m; n7 t3 Q1 u if (id == "")
3 C3 s/ n4 I2 H. Z { @/ E8 \2 d- N0 t- F, d$ A0 z. r( R
alert("请输入注册名"); ; l% W! w6 A* Q* Q. m9 y+ c
document.sform1.id.focus(); ' q4 ?" C. u. ]9 C1 q
return false; , K+ U: j6 F7 U j
}
% p2 D! I9 Y% v0 G* Q : V6 ?2 g6 j, [! f: N
for (nIndex=0; nIndex<id.length; nIndex++) + E% u1 L" g& i9 _9 P1 ^
{ 3 A8 ^* X; T+ X+ D$ I! z
cCheck = id.charAt(nIndex);
) }) X" a; E& t if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' Y0 U" p. f0 n; p3 m {
$ M; g1 R w2 E9 U" x2 S; F alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
J5 t8 \5 V. c3 b. w document.sform1.id.focus();
5 n: t! k2 w$ W' @ f s( w8 a return false; 3 J2 y+ g$ F; Y O, d
} , \7 v1 G( w, h
}
! E& z4 L: }0 d5 @ chineseid = document.sform1.chineseid.value;
7 [! V) c: Y) U if (chineseid == "") ) N: c7 `' g% Q+ A9 o1 C3 o' h: Q
{ ) ^8 a% X e8 @, G5 F0 g/ i' Q7 ]
alert("请输入中文昵称");
0 M: B1 k9 Z! I document.sform1.chineseid.focus();
) V6 t& E/ P( f" m% l2 x8 d return false; 6 M& U8 {% q' p! K! X1 S
} $ ~5 z0 O0 K: w0 ?1 k
password = document.sform1.password.value; / T6 s' |) L/ n! _, H
if (password == "")
5 Y! a- T) k) G0 B( D { : ]( i4 J8 Q$ ^/ E' M+ i! M
alert("请输入登陆密码");
2 ]8 L+ ^. W' G; _, Z document.sform1.password.focus(); . Z/ A& f1 E8 M: a- ~( R# \8 r3 I
return false; 0 e7 W: D2 Z p" q# q) n& c8 [
}
$ W9 g! z% _ q7 J; G/ K# o. l password1 = document.sform1.password1.value;
0 r: D% N- R' V/ S2 e if (password>password1)
& C) Z5 P, K0 ?' u' z) Y+ ~ {
: K2 i3 _) M' R7 ?7 X( F( Y5 r4 y alert("重复密码与登陆密码不相同");
/ y. J M1 Z* x! g! q$ T! t! E/ Z4 @ document.sform1.password.focus();
8 D' M1 s& \* u6 A& g# v) P document.sform1.password1.focus();
* E0 M* Y5 z" S7 T+ }, f return false;! n* B% i0 e! q
} " `. g7 J8 `* u( E! k# D
if (password<password1) 3 I6 F2 ]- t9 y0 E) N* _: \
{8 ?- Z. i3 v% {. k* n
alert("重复密码与登陆密码不相同");
3 }2 U. [( @& ?# U document.sform1.password.focus();
5 H1 @7 c, X* G# A; z& \0 ^9 L document.sform1.password1.focus();
- h0 O. s* h% o1 K5 a+ e return false;
0 {3 e' S# g3 ^( B9 H& _7 ~ {0 g }
! {; q" G9 { R5 K |; @ if (document.sform1.email.value == "")
" i! K3 W W% h& N! ^& T {
8 E+ c' s/ M9 N7 `4 j alert("请输入您的E-MAIL地址");
7 u' S$ f1 R6 s4 {+ m3 D document.sform1.email.focus();
) i8 k$ M% ^. | return false; 7 c, I) E$ L& L/ D9 F
} ) q" ]4 _% z" N$ n! x
R E |7 j" _# I, V
email=document.sform1.email.value; 2 _- ], T+ B1 h4 U9 `
emailerr=0 9 C" J* { v% |. z8 J" ^. D/ i
for (i=0; i<email.length; i++)
9 N: C0 R" `) k' o, r, w) s$ s { & [/ j# L, n$ S" W% ?% Q
if ((email.charAt(i) == "@") & (email.length > 5))
& o7 b1 S, q9 v9 B9 R0 b {
( [! j5 C; D% |1 N6 Y. D emailerr=emailerr+1 - |! N" H! g+ D! C/ G
} 3 }4 S, T6 o* @% _( g
} - x) j) |4 T; J$ k# L- M( d
if (emailerr != 1) $ {- N+ `2 |8 o4 ~, H
{ 0 h, g/ C. [' h) e( A
alert("请输入正确的E-MAIL地址"); 2 ^% }2 w5 ~1 h& U
document.sform1.email.focus(); 7 x% \9 b" ^+ `' Y* F+ o" T
return false; x6 g% X$ r: z2 s1 K
} * {5 y: i# O( r- v% V2 V
( J8 u+ C! b5 L4 J3 a! @3 k8 |8 S" ~4 ^ if (document.sform1.checkask.value=="") ; S, l1 m( |: E9 t1 M! @; C3 D
{ - Q( O4 r+ a9 M3 P
alert("密码提示问题不能为空");
! g2 r# A) a" ?6 J4 x$ R document.sform1.checkask.focus(); $ m' f% W$ t4 R# f1 W
return false;
) U- v7 H6 U4 D7 ?7 {- i } 6 S& Q$ f, j2 \. s7 f
if (document.sform1.checkans.value=="")
, N# X3 f( a' V) A {
& p5 _$ N7 ^5 |$ [3 G) B( g alert("您的密码提示问题答案不能为空");
' `' h: n( w! G/ w7 J1 j document.sform1.checkans.focus(); % P; |) r* A6 }) E0 h; f! L+ }
return false;
7 X6 ]4 k9 A2 v( y( P V6 \' w }1 M9 [3 M& w( A9 n" d" U8 e0 O
return true;
0 E$ a0 }8 z6 ?$ b: d9 I + q/ p; \9 W% f
} $ i+ v8 C3 P. H$ e% s0 _; u. b$ m
</script> |
|