|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14417
- 金币
- 2494
- 威望
- 1647
- 贡献
- 1442
|
这个脚本对你可能有帮助:
l" b' k$ p0 l+ O" ~& `+ d) X<script language="javascript">
" Q. u7 _8 r9 z9 Q7 P# o) V2 O- v$ tfunction IsDigit(cCheck) ) y* c5 w" S+ t$ Q7 P9 R. K
{
6 }% Q9 s3 D- O8 k- P' r) S0 g return (('0'<=cCheck) && (cCheck<='9')); 8 A. `6 S4 G) h1 z: L* P, G
} , V( |8 E) W2 q6 D
/ Z3 _. B9 X' b* ~1 w& Wfunction IsAlpha(cCheck)
: s# r+ {9 x. p8 U6 [ {
# s8 X( W) w- }6 _) o6 N+ y2 I4 E* p return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) , W9 ^. G) P& {& e
} N) Y! L" v) O, r7 m
4 h( Z% t+ S) s+ r" u) }0 cfunction IsaNull(cCheck)
* \+ O" o: P) K2 S; s {
# u$ D3 b! C9 h2 q& [ return(cCheck != " ")
# [: W! x" e/ f- J$ C }
8 \- h! Y; U; \- u0 z
3 X1 H3 P% }% Cfunction checkform() , S0 F, x4 X9 x" W+ k' x7 N! N
{
" s; c) B9 x: t# Q3 s4 T id = document.sform1.id.value;
2 m. G- L7 _: c# G if (id == "") , k ~5 m8 b: Q1 o
{ # _/ K( v# {( l) V- A5 S1 a
alert("请输入注册名");
7 V+ b) S7 a) _) j1 }% a: F document.sform1.id.focus(); + N6 H3 h; V* F
return false; ' r" Y+ K+ x4 I; N
}
2 X# _, t w# S8 e2 y
( W2 x' X7 n3 \. w& s8 b for (nIndex=0; nIndex<id.length; nIndex++)
9 l( _- a; d7 g; T5 e { : [- I$ N; o2 t" u
cCheck = id.charAt(nIndex);
; J+ ~# `* P9 C; k* c! ~ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
/ y8 g1 D1 N& X5 u {
/ H! P' Y+ ?4 Q2 Q8 k; r alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' ^, f9 V0 \! k; Q" o5 r# C7 ?$ q
document.sform1.id.focus();
3 n5 o1 P. o# w return false; 0 C. ]$ B/ p$ B1 ]' o J7 j
}
0 c7 n5 z5 X0 _. F+ B* L" f3 G! E }
8 V* I. f* g/ z6 c M6 c chineseid = document.sform1.chineseid.value;
8 _. t. O4 O7 W; U: E% s8 g5 p if (chineseid == "") / j8 O" W' M- ?; P
{ ( O3 r# S9 Y: k5 p/ d
alert("请输入中文昵称"); ( r# t8 M* N) c4 k* y. Z
document.sform1.chineseid.focus(); 6 K9 C% j7 x4 o) B. p* U
return false; * x, y, B- K( ^; B7 c
} 7 S" ~* H1 D5 n' G+ V. }2 m
password = document.sform1.password.value; ) ^% B: T3 `( q, O" n2 x
if (password == "") , O; g2 F& n$ Q
{
% y, M$ r# W) o alert("请输入登陆密码"); & {/ J. `! N; \8 D' c1 A- j0 E) @' |
document.sform1.password.focus();
) N3 Y$ ?& q. i; S) | return false; [- S( X* p7 l9 j. `/ N
}
- D* X& {& @! K& j! A password1 = document.sform1.password1.value; ' L X% p9 a$ ^4 ? a) r0 a( B
if (password>password1) : {9 I! z" a; e% I
{
1 [3 E. M& @/ m" w' d8 M5 D, x! \ alert("重复密码与登陆密码不相同");
" I0 X; \! ^$ Y! H document.sform1.password.focus(); / f! W4 U6 c3 P8 c9 [0 i/ i
document.sform1.password1.focus(); ! a; V5 b+ i% W
return false;) |; E5 t }8 e, y
} ( x$ H! g& W2 }. M8 j
if (password<password1) 8 J$ G# Q( P+ o+ `* K, M. C
{' `# ^5 u( j! S0 }3 B0 ~* j- U
alert("重复密码与登陆密码不相同"); * w1 B9 o: h5 e5 \6 x: C& e
document.sform1.password.focus();
" {1 \, S* |& j document.sform1.password1.focus();
7 Y- F2 Z/ {& k8 R, V, o return false;
6 S. V2 W5 p, ]. P }
2 }2 _! ~7 F1 H4 Z2 {7 A: H$ D if (document.sform1.email.value == "")
3 {6 w" r; H2 q9 e {
[1 u' \6 h& I7 }) c* U alert("请输入您的E-MAIL地址");
1 z5 Y0 x& d6 P" o3 ~$ ] document.sform1.email.focus(); % Q5 R3 Y5 R! ?( y4 a, I8 c w
return false;
. I7 A8 ~2 k+ b2 m' J% ] } 1 |) e# \' u/ ?8 n
" N0 s8 P. |; ^
email=document.sform1.email.value; 4 j8 u# o+ X8 J& c5 i8 _% l
emailerr=0
5 _. G+ n# s! R/ d8 u for (i=0; i<email.length; i++)
+ x* X \ o$ C* N2 ~3 r { + {3 n. Y3 d8 Q1 x5 S8 x
if ((email.charAt(i) == "@") & (email.length > 5))
- _3 P7 Z2 r% I w3 e {
( n+ K. t# }; o. ? emailerr=emailerr+1 7 H- a7 K) Z! G3 T2 s- \
} 5 G& C. S7 x# u' O
} 5 c. `3 J% b; G) S/ f& I
if (emailerr != 1)
+ L# c) D3 O& R0 q4 ~) j { ' W/ [( G) @/ q" y: c8 m$ ~
alert("请输入正确的E-MAIL地址");
' F+ }& V$ K' E0 n* e4 r document.sform1.email.focus();
* M; i6 s( A. S" X/ l% i return false; 1 T" f. c( Q6 s+ |
} 7 `! V; s1 {2 R+ ?: h+ B
* w v6 `- ~. N u
if (document.sform1.checkask.value=="")
' Z, o7 w& C" B( @ { " X/ {/ D5 u7 D2 } I" d) }
alert("密码提示问题不能为空");
: g7 H6 [' F. ^ g" C8 M document.sform1.checkask.focus();
: n& m% a6 |: |/ U return false;
! {& p/ C$ \2 c } ; l6 i/ W& G4 [- B7 z! ^
if (document.sform1.checkans.value=="") ' e; i7 @, Z1 O# q3 O
{
+ S, F0 _( ?% L% k* S alert("您的密码提示问题答案不能为空");
$ k- D7 C9 v+ I# z( S9 w0 Q document.sform1.checkans.focus(); ( m0 }8 ~1 K( U |# h1 o. I: v4 V
return false;
- E L' ~! X, S9 m }
t% _: V- l( z return true; 6 H3 {4 w$ E# A) E6 W
! I4 z$ m H: i" E
} + y3 K3 j* l7 J8 B- L
</script> |
|