|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:
4 a1 n( W" h& S; n, z<script language="javascript">
9 B2 Q* C _, b b2 [5 {8 Kfunction IsDigit(cCheck) : N9 {# e3 H+ r
{ : H# F7 a, D- w$ H, T+ o% G9 g
return (('0'<=cCheck) && (cCheck<='9')); & C) g/ ~2 ^* `5 K6 y4 @ I' K7 E* |
} ' i7 K0 ?) z/ P3 m& J* p
, H/ Y+ d9 |" B
function IsAlpha(cCheck)
Q: @' a, t j* n: @1 [; e { ; I" R& t! K& F, \; X1 c
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) " N$ I5 c- X# h( U, O% ]
}
) U8 b. b! Z$ T8 `; c X/ b $ m8 b+ ~" n }, {. l
function IsaNull(cCheck) + k. [) I+ g: u+ Z- `7 w% ?! v
{ ( u* x) e' r( j, d. A+ o; V1 X& J- ^
return(cCheck != " ") 0 U9 Y6 r4 F3 h, v; B
} 6 N( }8 z& l g5 ^/ @
( `+ |& ~0 n+ K9 {3 V& b4 Pfunction checkform() . t, N; ^" T) a" d8 k) O
{
& `! m$ K* Y2 U3 K; d id = document.sform1.id.value; ( n0 ^, d7 X W0 w C- d" P: n
if (id == "") * }) {$ z3 {5 `$ L& a3 x: l
{ ' i" t, @! e: ]! l# i2 @
alert("请输入注册名");
' n1 _ g9 [6 v+ I3 J document.sform1.id.focus(); + N7 y4 D2 c; f& K8 p4 Y V
return false; 9 I" L/ P; |1 ~ \) W' P
} ' y( \9 \) X) V5 j: g. Z) K
1 J% X$ D% A9 G& O3 J for (nIndex=0; nIndex<id.length; nIndex++)
& [: z- Y; V, s5 h( J { " J9 `- \8 E5 r, G/ x5 q9 g
cCheck = id.charAt(nIndex); # M3 ^7 n" x6 a! ~) S. p
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
2 e/ C( j$ N K {
( Q5 ?7 p( y) [" u5 [# j" ] alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 7 C: G4 [+ n% D
document.sform1.id.focus();
" [% f5 L/ H. _; v return false; ' e; z: e% r. X
}
4 r- w$ Y2 u& E# g& ]2 G& |0 p }
( l* x* f7 r; @" |1 y0 N3 c chineseid = document.sform1.chineseid.value; . ]+ `* d+ f1 |$ l
if (chineseid == "")
- R0 q0 H( [% Z) e! h! x) e {
1 ~; c# i) D# ?8 Z5 H alert("请输入中文昵称"); : G: K+ I& A. X# C1 A
document.sform1.chineseid.focus();
: L7 S: f' `& E return false;
# @5 [9 ~+ a# F( m. C- F }
3 Y' o# d: F4 N4 p5 O password = document.sform1.password.value;
; O( I+ p6 R; G1 e' H if (password == "") ! U: L% \0 ~/ G" g
{
. P/ R" }+ }1 l. {8 X+ M0 B alert("请输入登陆密码"); $ X3 n4 S$ b2 x' D& R" y
document.sform1.password.focus(); ! }, b u& t+ `$ [
return false; ; I8 |9 n7 K" k/ Y
}
/ t% F! O, s9 T5 U1 p9 ]: I) A password1 = document.sform1.password1.value; % u5 r; N6 ^! ], a
if (password>password1) ! e( g! W. g% O
{/ @: _2 f7 Z9 D& m: ?
alert("重复密码与登陆密码不相同"); : d; E, `: E6 |3 m7 `
document.sform1.password.focus();
4 k6 z& A' O3 Z" s+ } document.sform1.password1.focus(); / J' w I$ V' g
return false;
( s0 W) n; p$ k8 O8 T } # k7 }/ K" B+ [+ U1 Q E3 U: X
if (password<password1)
( O1 N. @0 r3 O. W {+ c7 U# A7 {8 X. ^
alert("重复密码与登陆密码不相同");
, J7 N/ d/ z* R6 u3 E& u document.sform1.password.focus(); 1 h! J8 t8 o# l
document.sform1.password1.focus();
. Z6 o" e, r' ~; ^, ^! F return false;% }8 w: F. O- ~& A5 V' e
}
7 ~1 c4 M# g: Q9 W1 u. c if (document.sform1.email.value == "")
2 A5 B g2 }, F9 G" \; l) [ {
$ ?; i3 V9 ?, u( C6 b alert("请输入您的E-MAIL地址"); ' X: f, x, H/ V* j5 i) G
document.sform1.email.focus();
; c& l" A3 i) a% T2 e9 j return false; ; r- P3 i' o; i
} : Q$ z4 @ c. `- G$ m( d
$ R! D' b: H( C! h email=document.sform1.email.value; 8 A8 [* P( @9 d( v4 w3 L: b+ |
emailerr=0
& `3 \9 D( D" B. p* ` for (i=0; i<email.length; i++) 0 V2 i0 T9 m, n0 m D
{ " c3 l& B. H$ z: h( l8 U3 N g4 ^
if ((email.charAt(i) == "@") & (email.length > 5))
; E1 x; d3 v9 ?. x2 X) @5 O2 z {
2 c! \7 x1 A3 M6 m& H3 U1 y1 y emailerr=emailerr+1
/ B! L* S3 b6 {9 d2 b }
) i- }3 F6 }, t1 ]6 p0 H$ q" F! E4 Q } " j x: G( `3 w- U6 B: w
if (emailerr != 1) ; \6 B( |/ |7 Q& S, j: f- d
{ ) k) F$ r V% _
alert("请输入正确的E-MAIL地址");
6 C! T* G, h! Y document.sform1.email.focus();
+ I0 V2 S' y# o# Y4 ]( U, _# f$ M2 u return false; % Y% T! x' i$ r; o' o
}
& y3 w6 o- H/ B. m. u( _ : F* r9 ~' j$ ?+ ?$ R
if (document.sform1.checkask.value=="")
+ V5 _: k- m- Z' } { 7 d r: ~- j* f2 k
alert("密码提示问题不能为空"); 7 L& M; M( y s7 g6 ^5 O
document.sform1.checkask.focus();
! \0 d5 @: [2 u/ y) u return false; # G/ \2 z& l1 @0 ~ w6 I d
} 9 }+ Q( A; v) G' [( W' `9 y
if (document.sform1.checkans.value=="")
. l) h7 ]* T" ?9 x/ n' {9 O {
5 }/ U6 @: ?1 N% w: ^ alert("您的密码提示问题答案不能为空");
$ D, k" ^- ?* d document.sform1.checkans.focus(); e* V, ]+ E- g. u8 F. o4 l( i
return false;
* }$ O2 R2 [" _/ x }' j1 [# n' n% C1 O, X" k
return true;
N) c0 N; C/ Z. g2 j0 w# x
/ p! N, a; G1 b7 [; Z}
& S! ?7 y! b2 D</script> |
|