  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:
) A9 V3 x" ^/ H4 A) Y<script language="javascript">
. Q0 H# p7 b0 d4 P5 Pfunction IsDigit(cCheck)
/ |/ B: {) k: f5 {* X' T { 0 G0 C; }- u' P b3 B5 J
return (('0'<=cCheck) && (cCheck<='9')); . ^1 S2 M# u8 \
} $ d, @. I* U5 E0 E6 V
" ]) Z6 K$ n* ?$ [- q1 R: o: Jfunction IsAlpha(cCheck)
]% g1 k7 [+ P8 E {
) k: _" [* m( j | C return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) & S; K% `9 Q; S# Z4 j: L3 A; x
} 3 _- [/ L8 k- z% F2 ?
) N2 A0 R; d* g1 qfunction IsaNull(cCheck) 1 q. S4 j: u, \4 P5 G
{
) h, F0 j7 g9 ^) s return(cCheck != " ")
' W# U: H) e' g% h, H8 P } 5 f/ c" H! H9 [" z6 R2 \
( {2 l. A k i% L* ifunction checkform()
- D2 Y6 b8 U( h8 b0 [: ?% W{
# t1 J: @- f a h$ ^. x id = document.sform1.id.value;
1 `/ M* d3 G8 I1 m& g+ W9 o if (id == "") & c0 `2 s; x/ }9 Q9 G: H0 P' ]- g f
{ - I' U& ~6 Y& A1 x- T( }
alert("请输入注册名");
$ W+ q( Q" W- X2 [ document.sform1.id.focus();
# U& C# Y, k5 P return false; & n0 x+ O. u$ V2 g$ I# D' X. v$ p1 V
} " L$ E$ s R+ e' x2 M7 F; v @! X
* W. N2 s; r8 ]- E- p* M: S for (nIndex=0; nIndex<id.length; nIndex++)
" h5 v: n3 v4 c3 G {
% B* h# L2 e3 _$ n! Z cCheck = id.charAt(nIndex);
& a) T$ {, Z' ?2 x! i! D if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) - I7 k$ P, z; b1 r2 m( Q* {
{ / v \- S1 s/ l1 @
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); / B( P% b( R$ G( S8 W
document.sform1.id.focus();
: t# }9 C" n1 o1 _' G4 g return false;
% d: w2 u" H/ p }
3 i1 ~& G0 z; u5 z3 o }
; x, j% o" w+ ?4 x; B chineseid = document.sform1.chineseid.value;
# _- o3 K$ s4 c- t if (chineseid == "") : u) ?5 Q( _1 Q) Q; l
{
* R" _2 ^9 h5 \. W, `4 f alert("请输入中文昵称"); % n" K8 Q6 ?, H N2 B7 p" P8 \
document.sform1.chineseid.focus(); 5 ]' C. j( q1 }% s4 F5 U
return false;
]% x: `3 p7 e' Q' F. a' e } 8 U( |4 w, Q- {* F
password = document.sform1.password.value;
% i& k. P4 Z9 W/ P( V2 h0 N: A if (password == "") 2 ?8 N+ p. @3 ^; g0 u
{
8 s! P- B' d* }; @! _- B5 o8 t alert("请输入登陆密码");
T9 S9 O2 V; a1 o4 o7 x* j3 ]/ s document.sform1.password.focus(); c) G; S/ ~8 C# `% Z: o
return false;
( H9 f8 z0 Z4 b5 h } ; P( s# Y! t9 \9 B! B' u8 X
password1 = document.sform1.password1.value; $ i2 w: I7 U; M6 z* ?7 `
if (password>password1)
8 e, k# X) l& O+ K4 M+ j0 ^ {, m! ^. B* {0 J6 G- ^
alert("重复密码与登陆密码不相同"); . S8 L5 p! K9 Z9 s3 n/ d
document.sform1.password.focus(); + t/ k9 D' ^8 w; n. c: Q
document.sform1.password1.focus();
b# }% Y+ v$ M! {2 E+ A return false;
$ S) Q/ U1 j6 X }
0 e! A/ I" e5 P5 f2 L$ Rif (password<password1)
f+ m4 ]/ n/ a3 i# i3 ~" h8 T' b {1 W& W3 H/ Z2 x: s
alert("重复密码与登陆密码不相同"); % n Y- y$ e& a
document.sform1.password.focus(); 8 g* v: R& N4 s: q0 f) w; z# S; J
document.sform1.password1.focus();
1 k( [ P/ w8 N. a+ C0 R return false;
. M8 @4 K [3 o# w$ X Z6 t } 3 l# @6 e) a. c0 U" [8 l m2 ^4 R/ L
if (document.sform1.email.value == "")
7 @, ]- v) F5 k6 K' O# k {
! m" E' }1 f% b0 H- t' l" L" F alert("请输入您的E-MAIL地址"); 8 ]2 M5 ]6 {3 X" n$ H3 _* [5 t
document.sform1.email.focus();
, b. X' b& [! R% c! r return false;
1 w0 S- ^1 |5 H- B9 u }
& x: P( j4 E# S* [9 K : g" c2 o& Z1 ^+ ~3 u: ?: H
email=document.sform1.email.value; 9 \+ h# Z* |( u
emailerr=0
% D1 `9 O& l, Q. h for (i=0; i<email.length; i++)
! S2 X: m3 H9 Y! {$ s9 g {
! U( D, z: p2 V* V) g. h+ j if ((email.charAt(i) == "@") & (email.length > 5)) ' f8 {% ~& K. z& R2 R; o2 @
{
- m S0 [6 g& ]) v4 B emailerr=emailerr+1 # I, i$ _) U, c
}
, h4 z2 c# V/ J; i' g }
9 K6 Y N8 j8 B6 Y0 \ if (emailerr != 1) 3 e+ B" X% g: S7 Y4 M2 i
{ ) W# D5 u7 [- F3 b3 ^+ l; ]
alert("请输入正确的E-MAIL地址");
" V4 d) N2 @6 z( C; T* ? document.sform1.email.focus();
# N, ~: V- g( m1 y return false; 3 u! _3 G' H5 I6 l
} $ t& x* ?- q8 ^. h6 ~
/ Y& v% m h+ {& v+ k if (document.sform1.checkask.value=="") 1 j6 C7 @0 ^4 \
{
9 o. z0 X% I9 P% F" y7 _ m1 }: j alert("密码提示问题不能为空"); ) \7 W( F# E9 E- @8 ^$ w1 v
document.sform1.checkask.focus(); 7 p: {) l3 C7 N. ]' H; h
return false;
. [; a- m: a% T) t9 Z1 N( y2 L }
6 n5 F; U: j4 E1 b; j if (document.sform1.checkans.value=="")
. \, `9 V; h* c { ( ]2 r' B* T( ^7 t
alert("您的密码提示问题答案不能为空");
/ T4 J. \" B; n6 O, @4 D9 K: Y9 e document.sform1.checkans.focus(); . z7 S6 p: _- v% F( X8 N
return false; G3 W6 j k* [/ p6 i9 i/ T" r
}
& Y: k! t/ t; T5 F return true;
; ~7 i( ^5 Y# x% ]& T6 M" ~% z. Y5 Q 0 w; n, \1 S, p) \, v% m
} . {7 K/ w4 J2 }9 x' [
</script> |
|