|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:/ O6 t# w0 h' R, \2 g, g9 m
<script language="javascript"> ; Z( K6 X7 f, `8 u; V7 x% w
function IsDigit(cCheck) 2 b: Y; H3 _" _2 s# G1 P' c
{ / J8 B8 ^' I/ z7 ~( t% d' D1 z3 P
return (('0'<=cCheck) && (cCheck<='9')); ) g- X5 y, L& g9 K, D0 J+ s6 I
} 8 f J. k2 {6 |1 O2 C4 j _
3 D- y( w! S ~" dfunction IsAlpha(cCheck) / S- D3 ?! k2 c5 X' G
{
, a0 B+ V! r3 b( G return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) - ?; r7 N4 {& C; w$ X
}
5 j( h0 {( m; E5 [" K
; Q. c+ l! m$ g/ afunction IsaNull(cCheck)
- G X, r b5 W* x( p3 z1 } {
. [& D/ o% h( h. G" w/ k7 t5 k return(cCheck != " ")
, j, W# d' @" J# S! j {0 K F }
# q6 g+ h) V+ f* M* W
4 {7 y' ^7 B, ^# `) h1 b0 W, O0 Qfunction checkform() ( ]% ^5 ^5 S3 ~9 o3 m" k
{ & c. |" h5 n; r- {! `3 R/ `4 C
id = document.sform1.id.value; # F5 |- R8 a& P1 \" Q9 @
if (id == "") 1 C4 ?9 k$ {4 w- x
{
9 Q) @- Q2 q; O' i alert("请输入注册名"); 7 X5 d Y* {2 v7 { B8 I
document.sform1.id.focus();
3 Y+ y+ |. {/ K- E" M; r return false;
3 F! B, o3 T( c- r+ R/ X5 u5 ? } ! I; L$ y; _$ U; B/ t
: N! B' A/ S5 v for (nIndex=0; nIndex<id.length; nIndex++)
7 s7 f' C Y/ o {
+ v- V7 T& J' ]% q cCheck = id.charAt(nIndex);
% J5 I# |( ?4 d# Z) i if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
* Q; s0 K( m: ?2 ` { 9 i& y- F! h/ d/ d m
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , [1 M# e& j0 Y7 B
document.sform1.id.focus();
/ f2 I# ]9 T2 {1 n& | return false;
" x$ L- O: d, e* s4 K, v8 r; L }
) c7 [# s; |. p% [ H } ) Z) c8 c, c% u# L/ `5 |# F
chineseid = document.sform1.chineseid.value;
( W; o# T* M p4 Q if (chineseid == "") 9 e6 b5 O+ ~- H" Y
{
7 r v' c( M2 R) N# U9 h G/ | alert("请输入中文昵称");
- ^" Y* ^5 G: w( e) c, A document.sform1.chineseid.focus(); 0 U& \7 N" @0 d
return false; ! P7 Q k/ c3 `6 ^! D( A& ?2 m/ `
}
9 Q+ u4 }% \& M, `7 j password = document.sform1.password.value; % h/ G' y0 |. ~/ U+ Z3 z
if (password == "")
2 g9 B: A% n X) ~# }8 e { ( N7 p& ]' K/ O
alert("请输入登陆密码"); % S0 E% u7 d# V0 I7 p8 P
document.sform1.password.focus();
/ o, r' x% A/ H" r o* s4 y return false;
1 W% J7 W7 ~: v3 q& r: X s- G u } 4 k+ n$ G* S s
password1 = document.sform1.password1.value;
, i( `/ |6 {7 ^ L6 S# w if (password>password1) * J! B" O! D/ x7 V3 _; P
{9 E1 ]. Q' n. e, M$ S8 M
alert("重复密码与登陆密码不相同");
0 _( R+ i; |1 T* m7 k/ x document.sform1.password.focus(); 5 F1 K8 Y7 o3 K* T/ s+ I
document.sform1.password1.focus();
2 q% M7 z$ s" ?% b: U3 A7 N+ {" w return false;
/ E' G/ z1 _1 X* l }
! [# F6 B0 R! m, {+ ?if (password<password1) # r2 M! s5 Y" h; a' K% b
{
) Y& G& D) Q' y( F( ]* C alert("重复密码与登陆密码不相同");
# f! p7 E) b1 s, c document.sform1.password.focus(); b( o! b. v3 x' [ Z
document.sform1.password1.focus(); ! ?" t1 \ I8 R
return false;
2 P- x9 P X. P2 ~2 _ }
) Z: ~7 l+ e( @* C, x if (document.sform1.email.value == "")
3 W% c7 f) S+ J; [# t { 0 W' c* N0 A- h$ j; G9 }; a9 b
alert("请输入您的E-MAIL地址");
/ B& u5 F8 a! T1 a( k+ L2 W document.sform1.email.focus();
, a* D. ?, C( E% c9 S) K return false; + } W( q0 P0 j" Z; P* X% c
} , J' z& K6 h" q/ V5 \$ B* P
' }. {" \1 B) |4 w* z7 f, _
email=document.sform1.email.value; 9 v, n; @8 e# P8 o7 } Z
emailerr=0
% `) j7 C9 J8 U) {& H6 a# g0 d for (i=0; i<email.length; i++)
9 w, v: P3 t7 G$ X) J5 f* |, m5 k {
s0 {8 k2 I' J0 `/ |2 p. f if ((email.charAt(i) == "@") & (email.length > 5)) % l* q& f" v5 Z; }* t3 X/ ?
{
, t0 x' U. a& N) O% U Q2 R emailerr=emailerr+1 & @- @1 P) h$ l4 ^+ h6 C
} ! a- L, V% t: X# ], _) a6 ~
}
4 K1 g5 f G `. {9 W if (emailerr != 1)
) a- T; i; P8 S( [# q }1 v7 L {
' y- q' i& o2 @. O0 W alert("请输入正确的E-MAIL地址");
/ s" a% A# e" H6 A5 O document.sform1.email.focus(); 1 {8 Z' h9 y: @# O0 {/ a ~
return false; . L6 H4 z' J2 h. H8 ~* [( c
}
- l$ a9 G% n9 p5 H: Q
+ w, e) y5 Y6 d if (document.sform1.checkask.value=="")
- p% [% U2 P0 ?+ @( u { - ]) _% P/ _4 W: b5 j/ Q
alert("密码提示问题不能为空");
7 y% L O% z8 ~* f5 S document.sform1.checkask.focus();
4 E) d; S& M1 @ c& l8 D return false; ( n+ }4 J7 |6 n- Q+ h! t
}
7 ^. z0 D5 A8 b5 Q& I" u if (document.sform1.checkans.value=="")
' Q+ P) f- j1 @: k1 Y { c6 q p) k5 t5 a) W/ r2 e w
alert("您的密码提示问题答案不能为空");
' F' ^" n! n' V" ?8 @ document.sform1.checkans.focus(); ! V; k/ w X+ a2 M/ _ i
return false;
4 b R9 z) L4 y: B }
) J6 V. a0 c4 m* _" h! f return true;
$ B7 }1 @1 ?! v
9 V1 D" f' ~+ s3 j5 }+ N} * Y [0 ]( u6 Z- \
</script> |
|