  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14171
- 金币
- 2376
- 威望
- 1647
- 贡献
- 1324
|
这个脚本对你可能有帮助: V4 O+ y( \9 e
<script language="javascript"> ( X1 i& y; [, `+ v: f0 H' L% c
function IsDigit(cCheck) # h3 E7 H1 k* o# V5 j
{ , N/ i! M( U6 q8 _5 y! J+ d! q f
return (('0'<=cCheck) && (cCheck<='9')); # E1 S; y) M0 ~* ~
}
) j& ^9 G) ^1 t % q8 U b* q/ d, a/ [# ?* i @9 w
function IsAlpha(cCheck) ! r& q" V# `( L! f
{
, A: ^; y6 O1 S4 t! z return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
- [' e& U$ i1 |' d- R$ V }
; r" K$ G% F7 K! r; ?+ t ! d' S O' u4 r$ W
function IsaNull(cCheck)
2 c8 y7 [; C( ?% i8 z2 ` {
' n) O4 J, e R2 S/ x return(cCheck != " ")
9 ^% P1 W4 W+ ]+ T/ o7 {$ I } 9 f8 {! r5 }$ r* d
' r9 m, F- T. I ], F& \* `9 k
function checkform() * |8 o: i& f9 K7 m
{
7 t( u0 Y, `$ m4 k3 I id = document.sform1.id.value;
" h; Q B% [* y7 | if (id == "")
1 I% {4 R) _; K5 y {
7 g$ ~7 b% h2 V( Q alert("请输入注册名");
$ D2 s9 u' p: K4 A; l) i8 X, v R document.sform1.id.focus(); , h, A: A2 o+ }6 K/ j4 w) Q9 X9 P
return false; ! ]' Q3 ~. S/ @. K) c: Y$ q
} 4 b) S& I" q! X* @9 t
% ]/ m/ `- ?! {) D' I5 O1 e for (nIndex=0; nIndex<id.length; nIndex++)
+ A0 ?8 y. {+ y$ N* B' \1 _( e9 j { + p2 R! D1 i8 R+ |- F6 |
cCheck = id.charAt(nIndex);
' P# S; l+ E; z3 `. O if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) / k* q' K8 o' V b- o: Q! O; W
{ # J; g- W: l# Z/ e5 ]) N
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ) v/ _0 O* a& j
document.sform1.id.focus(); 8 a. x8 }; R1 P; D: }
return false;
1 `2 s" g; c* [ }
7 ^; E: q+ { w- k! j }
4 P' O! d+ K6 ~6 l chineseid = document.sform1.chineseid.value; " Q5 Q% ]* _' \% u
if (chineseid == "")
8 M, k8 A `# N- `6 A: N! K {
3 M. u9 t+ W* j: S4 K; E+ H: W alert("请输入中文昵称"); b! h! d2 _ Q) j" s% g
document.sform1.chineseid.focus(); " [- u! d8 S& A T! R( @
return false; 6 L# ]2 F2 P8 g, e
}
, t$ d, q- e' _& S password = document.sform1.password.value; % C/ n, `9 N3 | U/ W0 Y
if (password == "")
: a6 @0 P8 ?6 A& a. h/ K { 9 r; M2 p6 z, O
alert("请输入登陆密码");
5 p! w# i& X$ h6 x% k document.sform1.password.focus();
& _2 J* P1 |' i5 j2 a) d return false;
/ u2 w$ N( p0 i9 F( F9 n2 w' m } 8 i# a# E+ y X& x( K0 a% V
password1 = document.sform1.password1.value;
! A8 |0 `' G* j7 r( v if (password>password1)
% X2 f' D* Y; U$ [ {) s5 O- M* f( k/ O, U
alert("重复密码与登陆密码不相同");
! N& q6 J |& ~4 t2 h( C! S! T document.sform1.password.focus(); ) W5 Q, z7 z+ I0 ?' L* Q
document.sform1.password1.focus();
. ~& \* K9 @3 _$ o C* j return false;% E* K& y0 j0 m: {2 M
} ! H+ T% a W+ A: d/ s" d v
if (password<password1) ) d d- ]7 h# |! t, K
{
- k5 t! c1 ~5 P, a$ C* J alert("重复密码与登陆密码不相同");
; t8 B2 V! b7 O' i$ V3 n document.sform1.password.focus();
; ^0 o$ ^5 U) ?' @, s5 H document.sform1.password1.focus(); 9 h8 W7 E& Z/ ?0 V
return false;
+ `2 z( U, d2 O: c }
; o7 E$ k" d+ i) A2 }/ r% d if (document.sform1.email.value == "")
5 l! p- s, [2 V0 f {
* T! X2 n& Z8 F alert("请输入您的E-MAIL地址"); % M) V- a/ f. G) M+ G) e; j$ j0 K
document.sform1.email.focus(); 5 _9 ]) F3 G3 _9 A- p: E
return false; . n. S& R% l$ Z& x
}
- t8 d* v5 x: D; }# m - E' h" ^/ m9 ~
email=document.sform1.email.value; , A ~9 |8 N( o8 ?: e, z
emailerr=0
, ^7 ?% w" r+ _0 q: e. v for (i=0; i<email.length; i++) % s3 B9 |5 }! G3 H
{ 9 C, k, Y1 q7 c' |
if ((email.charAt(i) == "@") & (email.length > 5)) " X$ v0 O+ s2 f
{
" ^3 s7 Z" }. Z1 i! y emailerr=emailerr+1 * g) Y' D/ l1 k& J: m4 N
} + t8 r/ K4 O, g! D9 ~; {. C
}
4 ]4 h B- o5 X' C' B- X3 R' I5 V if (emailerr != 1)
) q8 m' v. n6 e& X8 d# w! Y4 a { M2 M( \9 V$ Z1 s! E; G( ^
alert("请输入正确的E-MAIL地址");
7 ], T! n0 s/ d9 u) v( e+ |/ G) x document.sform1.email.focus();
! f e% r5 r+ Y w return false; 2 r: q1 R! m1 J9 F6 S! S- C* m
} 3 d, Z$ D" j3 z: f; Q" @) d2 y4 W
! Y. ]6 S, t* T# [0 {( F if (document.sform1.checkask.value=="") ) T m" Z6 {4 ^
{
+ b9 H. ^- I) S7 s+ N1 D% E alert("密码提示问题不能为空"); : O. y: T1 ?. T+ e! E4 M* Q
document.sform1.checkask.focus();
2 z3 z. T! V$ `# B& S d return false; % p8 \# ]0 \) m& u* A$ [4 e7 @
}
8 J/ ^2 M9 N8 w0 I& P4 m if (document.sform1.checkans.value=="")
) d/ F0 [. y- W1 O8 v {
. Q R' K9 b( i6 r! k/ f' y- K alert("您的密码提示问题答案不能为空");
$ L5 U& b0 g1 B3 [7 v" R- Y0 c document.sform1.checkans.focus(); . j5 S( [1 W) x( O' Q6 u) K
return false; # C; n+ ^- z4 a% j8 e6 W& d3 U4 x
}
9 R1 h' J- O3 F& ~1 L9 ]$ D3 r return true;
0 o3 I5 s( a# }) x9 p |$ e% r% l& g8 ]2 I' n
}
3 r n* A2 D3 X+ S</script> |
|