|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14417
- 金币
- 2494
- 威望
- 1647
- 贡献
- 1442
|
这个脚本对你可能有帮助:# q, n4 ~* F8 W) |2 [% A, F
<script language="javascript"> 2 z; _/ i O. v* T; |6 s
function IsDigit(cCheck)
5 T3 T- y! O7 y! k6 a5 t+ K. p { $ g3 z) q7 C9 d# p; r& V+ i
return (('0'<=cCheck) && (cCheck<='9')); : k, M9 y* _; Q
}
8 p( ^9 b: D1 u! _8 g& J9 G- e; q! Y- C % s2 P0 w, {. Q& ]& O
function IsAlpha(cCheck) # } r0 K& T# S2 t& R) `
{ * D& @" e3 R( ^+ k; N
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) " g3 z; I4 l3 N
} * m: a8 }$ n- B
4 S9 D* x$ Q2 P& Z9 t$ o6 D
function IsaNull(cCheck) : Y5 Q$ ^# r; Y8 O
{ 7 O) F- F) t$ i* C5 L/ n* [
return(cCheck != " ") 5 C2 Q. N; b) k8 W. a1 Y( O
}
# p) d. V9 `3 J' \4 A- i
: J! E+ N5 Z, y8 Kfunction checkform()
$ s t) u2 b3 W) Q6 U N" Z0 k{
5 R# e0 L; w; y! Y id = document.sform1.id.value;
5 f8 F; P. x' E6 a if (id == "")
" x) W; E" y6 V0 B) H {
* l* q. S5 ^1 \/ w" w8 {( u alert("请输入注册名");
5 `/ |3 q8 ]! S0 U9 X document.sform1.id.focus(); , V2 Z9 N- E H9 L T4 W* @2 z
return false;
9 |5 L! m% p t( j6 O) t9 H& @9 m( J }
1 X6 b* J0 ?' G4 k) ?8 j: s + t/ S4 e/ V2 ~7 o
for (nIndex=0; nIndex<id.length; nIndex++) 9 O( |3 j: F0 J/ \0 |' ^: [ j
{
& l I- n. x' x0 e8 C cCheck = id.charAt(nIndex); & l! X5 G Y0 B, N" ?8 e
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
0 I; b( m/ Q1 x; X9 l7 R- Q6 X {
0 L! H y8 Y7 l p+ u- B alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
6 s7 F4 y4 o) G2 L document.sform1.id.focus(); + L7 |7 S; q; c% J& v
return false; 7 j' i* Z3 F" ?3 G# o
}
e0 y! \$ @* h } . _$ z8 L0 X1 i2 \6 V+ v% a3 F
chineseid = document.sform1.chineseid.value;
! o4 d( [9 H k if (chineseid == "") 2 X: T# n" s- @ O9 M
{
, a1 B5 c; D7 W/ M* w alert("请输入中文昵称");
$ |& z G2 C1 e% z, { document.sform1.chineseid.focus(); 1 |! l; m4 b/ j. O, L b$ o
return false; ( d0 t# \( O$ V$ W% ^8 V; T2 _* V
} " W% B) I" j: M: b
password = document.sform1.password.value;
( M& _9 F: l' E# L if (password == "") 6 Z, ?. X6 I% i @! h6 ]) R: \* S
{ 1 I7 _0 d4 F$ C; f5 Z3 }
alert("请输入登陆密码"); 1 J) @* {0 t) a! M5 r# {
document.sform1.password.focus();
( Z5 ?; m/ w1 j8 m T return false;
& \( i( B& z- [: l3 V& T! ~! q } ) c0 k8 t* p: k2 M1 q$ C1 ^) M! B" {
password1 = document.sform1.password1.value;
( T2 V: u: S1 R2 W) y if (password>password1) . t$ m0 U" ~8 E1 L8 t) f8 { i
{
: N3 i) J# h5 B, p1 h. z- l alert("重复密码与登陆密码不相同"); ; l& o4 |) O! `0 L. `/ W
document.sform1.password.focus();
, L! [ P7 v2 B: c5 ? document.sform1.password1.focus();
8 f9 o, j2 O9 l4 [( z$ F( T; m return false;7 u+ J4 M6 p' v
} 7 R/ s( r, X5 s% c# J8 e' @
if (password<password1) / n3 y ~4 D) v. W
{% ]) c3 [4 ^7 `
alert("重复密码与登陆密码不相同"); 6 @/ E4 O1 @) G. S9 I
document.sform1.password.focus(); b+ ^5 k1 j- N/ D4 Z [
document.sform1.password1.focus(); ( ?3 c+ Y3 C1 y7 S% x
return false;+ `; M/ M& z- m, ^0 Q# Y6 e: d# l. q
} M' l* \9 ^3 J4 D- e9 D
if (document.sform1.email.value == "")
5 ~ |/ [/ f6 k) \& u, U5 ^ { 4 D. W# ~1 r0 y& ]
alert("请输入您的E-MAIL地址");
( f; R( S u4 w! ]! c document.sform1.email.focus(); 3 |$ N/ T0 P3 D, {
return false;
5 X9 o3 y2 ^! ~5 `' U }
, R- X' A" A+ G6 W 0 p: x; Y; K! l1 Z
email=document.sform1.email.value; - t M( j0 m7 M* @" V+ C
emailerr=0 % S3 s4 B# t: v4 Z2 ?
for (i=0; i<email.length; i++) . V7 T# X8 i" j
{ 7 I8 [' ~& m9 H5 @ \
if ((email.charAt(i) == "@") & (email.length > 5)) & L# \8 A. ?. c: }6 E9 Y8 k: F, u
{ 6 ~/ m' H5 w q2 e
emailerr=emailerr+1 0 Z* a, ]: j$ Z0 l% o. s# K* {( r
} ]. U! Q# I; S1 s9 U
}
9 [1 j* W5 W0 Z0 Q# @ if (emailerr != 1) 2 E2 Z. e. \, H
{ ( e; r e) i' b! Q5 m' c; p! z: g
alert("请输入正确的E-MAIL地址");
) y3 L8 n* i! q7 Q6 |4 B! T0 h: O document.sform1.email.focus();
6 G7 u( e4 l. }$ ]+ V. P return false;
5 w+ h, ?# ^, ~, U" `0 b* m } & `3 y+ t- Z; ?$ \+ g
1 A" t9 e. S. }5 U* e" d
if (document.sform1.checkask.value=="") ( }! G' d( M- p& F, p
{ 0 h- B9 X+ Z5 E
alert("密码提示问题不能为空");
/ P( l/ n- P, G& o5 I2 _0 z; { document.sform1.checkask.focus();
0 o% n; B& K( { return false;
3 ?% E, u; O: y( q }
4 h1 k" w# {/ @, f8 m( K# f' X* E if (document.sform1.checkans.value=="")
0 C) w3 j( K9 X7 h5 _' r9 } { 6 L: _0 v4 v$ d. d3 ^ a4 v6 R7 I
alert("您的密码提示问题答案不能为空"); 9 \) E! g3 ]! k) ]- J
document.sform1.checkans.focus(); " x% b6 f3 x: u: d
return false; ( J2 v2 e' ^6 S; h! ?
}' |" l$ d: V2 |' b, z
return true; ! x* ?( A) O* c/ ^. Y. J
$ X3 `: N% t3 Q) x2 x5 C2 |
}
# l l* d% ]# g+ u& I% ?! N</script> |
|