|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:9 L& a, |* E5 }) N
<script language="javascript"> 5 y5 R1 W% g5 I; z6 J
function IsDigit(cCheck) ; l, Y0 U5 @+ a; w( P! B: I
{ & F( j! k) c- j! \5 d
return (('0'<=cCheck) && (cCheck<='9')); ' f, }+ U7 ?8 \
}
' ?! r3 f8 ]3 j8 }, I
5 [! s, S8 x$ s3 tfunction IsAlpha(cCheck)
2 T+ g) `/ k; t) Q { 3 W6 A1 H) x- i- s7 n; W
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
, b) l1 A- e. I+ c1 O, b' F }
( G( h. V4 ]8 X9 J- q; O7 v
: b. e1 B Y: e2 Ffunction IsaNull(cCheck) * H" W$ q2 X1 y2 m1 T6 M
{
1 q1 L: \% L% a: [7 Y+ } return(cCheck != " ") 2 m2 o( b. R* J6 G
}
# [7 L/ W4 q4 r& p# I
1 M. {/ D8 C7 \. \6 F) pfunction checkform()
: G" Y/ w/ E, g{ 3 |5 M! U+ c- o4 Z- V7 @( ~- g
id = document.sform1.id.value;
0 `# i3 ^/ d9 z7 M N if (id == "") z4 \2 u e @# G$ n8 c! Y
{ % s1 ~6 T+ j5 v
alert("请输入注册名");
7 y& A, S0 F! y0 m& ^4 j document.sform1.id.focus(); ) o, O# M+ ~5 ]4 F' ^* e' K$ r! n9 {5 v
return false;
8 A; J; A& i4 g5 a3 o/ X: e } 5 g2 ?& r9 ]+ B% C
3 B. l, R- r6 H ]. P
for (nIndex=0; nIndex<id.length; nIndex++)
* n, s X1 s' C9 Y7 s {
2 E& w" P% E0 g4 l+ L cCheck = id.charAt(nIndex);
1 I' h0 c0 B! d2 k if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
0 C4 A2 s/ a$ Q# p8 b { ! K& p3 i; g! H6 E# l3 v9 G4 V
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 6 r9 o, Q0 [* B- {: c- x
document.sform1.id.focus();
& a+ G" z2 m0 M1 X* N6 O return false;
: ~2 K: `4 f8 g" z4 | } 1 o) T+ \# I, Q7 o8 c
}
3 k2 Q5 C1 x7 a. d0 C, C chineseid = document.sform1.chineseid.value;
$ N f4 c: L. a0 r0 [/ z" g if (chineseid == "")
* C# E7 z( P) }1 A! e7 E& L* g {
$ i) _1 u% n9 C& N7 u) ?. S3 n K alert("请输入中文昵称");
* {, C- ]3 _# s' o- O document.sform1.chineseid.focus(); ' X7 O' ]1 I9 x7 X; r0 ?
return false;
+ v9 r1 Z- p a- N9 q) d/ f: o }
; O& T0 t' v% d' p. f5 y3 z- Y3 r! c password = document.sform1.password.value;
, G, s, c9 w$ F1 j: K; T if (password == "") - f2 |1 x3 M1 c* U% |* z% j& c. P& R
{ 6 P7 s# E+ i8 ~* p
alert("请输入登陆密码"); ( L5 X- W* i) W5 b% [( a
document.sform1.password.focus();
0 U7 A6 O) N$ c; h- ~$ f& ~ return false; * ~4 U0 j% a2 b) E9 {% b
} 1 `) w* X: g2 e1 @1 W1 G6 y K
password1 = document.sform1.password1.value;
: I& e, h/ A1 _ if (password>password1)
- F; W. A' L$ q" M0 k) H {% Q2 D' \7 e# \
alert("重复密码与登陆密码不相同"); 7 \2 l4 C! {( s5 k+ R+ b
document.sform1.password.focus(); # Z+ c, s6 T7 h- H8 P& a
document.sform1.password1.focus();
0 G- J5 _; ]) P" t& d) J return false;( y9 i7 {: x3 B1 S. M7 W+ m( r
}
: V6 E6 I" h" ]% H( @: j5 u" X; uif (password<password1)
$ e2 ^' y) a8 ?, w2 \" O1 f {
! S' i2 ^/ D5 R) w$ S) F0 O. o alert("重复密码与登陆密码不相同"); 8 A b. V& [1 x7 {+ ?) c, R0 X
document.sform1.password.focus();
/ T J! H6 `& H( V" r+ G. g2 i document.sform1.password1.focus(); $ q+ c4 S3 n( u4 |* ?& p
return false;$ R- O0 P/ p/ }( I1 b4 s
}
# |. \' @: p7 Q' _$ \" v% t( k1 N6 B4 W if (document.sform1.email.value == "")
# i g& Q& `! s" [ Q! w3 Q {
; j( z; u# a8 U1 [ alert("请输入您的E-MAIL地址"); , A1 O1 q6 p4 T* F5 I3 H
document.sform1.email.focus();
a) Z$ T5 F% k$ Z return false; ; P3 g- J9 J7 B; `# k) Q4 a3 v# S9 s* z
} $ ?3 B/ d; v- W# n: X; f
) y9 v8 \4 ]" v& H email=document.sform1.email.value; . Z6 @4 s+ A) p; q2 `1 W
emailerr=0
& w" p) I4 N1 r. F2 }7 t for (i=0; i<email.length; i++)
' T) k1 o* ?+ R/ n! Y( g& v {
# `' J9 J7 o8 _ @8 J8 ^; O9 h if ((email.charAt(i) == "@") & (email.length > 5)) " X- ?$ D0 A: _) s* S5 ]* k+ F
{
# [2 x5 _8 ~7 N Q emailerr=emailerr+1
: e# d. u% N0 S4 v' L }
- j, @! W2 f* S# z } 0 J& b% W$ C, t% G
if (emailerr != 1)
( V1 W3 [8 M5 ~' w% B1 R {
1 O# o6 W) v5 m) I alert("请输入正确的E-MAIL地址");
: ?2 c, L: v9 X0 O- @* { document.sform1.email.focus(); / e$ k" i2 p$ L* J
return false; - v' |2 g: L; b
} " R) f# z, Q! ]2 l3 B5 c# M
) n; o n j |: a( e
if (document.sform1.checkask.value=="") ' Q2 f6 d1 U3 s- ]" U
{
N" D3 Q k4 N1 C4 p- A( D6 y alert("密码提示问题不能为空");
# p; M# j" A7 \1 f document.sform1.checkask.focus();
2 I1 o$ f6 F2 h return false; / ~" v' o* d) |; O3 ]% S4 {/ s) S
} 6 g5 Z" m& `7 K; P2 G: j P) u8 j* p
if (document.sform1.checkans.value=="")
* t" c/ b d8 R: W6 q2 t* F8 x6 w8 q {
* R, ^ J9 D2 s& l& [+ k. a3 \& N alert("您的密码提示问题答案不能为空"); 8 E( O) Z+ ]# M/ S
document.sform1.checkans.focus(); 6 ?6 W( {7 P; b
return false; * z1 {4 U5 I2 I' D+ n4 ^4 T5 x
}
* c V( J: B. m return true; % m7 B& I: _1 O& x0 t* {7 }0 z
) j$ n' ~$ H" L9 }# Q6 S
}
3 J) V2 g' W4 W; b3 \4 S</script> |
|