|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:
: K. K& u3 e" l& m. W<script language="javascript">
% p {, ?0 t/ e( A/ ]function IsDigit(cCheck) ; F+ [4 Y6 T4 J; D+ L- a
{
8 _2 I7 A3 P G j return (('0'<=cCheck) && (cCheck<='9'));
0 ^5 l/ T' ] k }
: G- }! ]0 ?2 s& F9 b' b6 \
2 d5 b) a$ R; o. j* W( e! dfunction IsAlpha(cCheck) / W" d) d) e. Y; ^+ s
{
# l- U4 g7 k% ]: @ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
1 [! G4 e9 z* E% Y1 E4 V6 s R }
. b# O" H: `9 s" b
" {8 H2 E: {% T8 K+ v4 pfunction IsaNull(cCheck)
! Z3 I( `& q8 Z2 _ { . E8 V/ M8 f. A- t
return(cCheck != " ")
; c* l" a' g# r7 L } ; n3 I- K% s2 w! P# B) L) y
" y5 i2 D, q# W) |* H. Lfunction checkform() ( A( n# e5 C. e! u+ j& m+ r
{ ' E4 q5 W5 u9 D0 `1 t1 F
id = document.sform1.id.value;
: P- R5 p* a5 U* @0 q if (id == "") ' w3 _3 w! N$ h/ q7 }; T. E
{ " E. j2 }) Y# H f; R0 X
alert("请输入注册名"); / O' R3 n$ i" a; R' Z n: @
document.sform1.id.focus(); - `+ b( F# J! `4 @' _
return false; 7 s* G0 P1 o2 j e9 p" n
}
5 N3 u7 w% y6 B. P
: t( E# Z0 s5 K+ S, p& K for (nIndex=0; nIndex<id.length; nIndex++)
& w2 t0 V4 m% ^; B; W6 A7 \( ]# ^ { L- R& Y$ R* s' r
cCheck = id.charAt(nIndex);
4 z4 V' g1 X/ v) h- b7 Y; \8 L if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! ?- z( Y. w1 A2 `7 e3 D; E1 i
{
4 v, B) K) A) e0 q alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 6 p0 l9 H' l/ G: e
document.sform1.id.focus();
1 f+ u- {: R9 A return false; 8 I# a! l2 E/ k7 }. D% e3 A0 {
} : d5 ^3 W q. V
} + Q+ Q/ L- \+ M0 M& V2 o/ D8 A2 o
chineseid = document.sform1.chineseid.value;
. } b y. D; F* |7 N if (chineseid == "") 9 P7 Y! L& r6 ?' A4 n) m' n8 S
{ 6 G" B. ]' e3 f& n; G
alert("请输入中文昵称");
: Q' q3 p6 ?' O6 w; j! a6 {* \ document.sform1.chineseid.focus(); / f; \7 _- n1 x8 k, M
return false;
% o+ p8 x, z9 d* m. K6 V5 @ }
9 h( L' g& m/ g0 @2 { password = document.sform1.password.value; , T) W9 ^: m W0 \
if (password == "")
0 h/ U6 H) F" [0 o { ' W0 F. i% @# Q& ~- E6 ^
alert("请输入登陆密码"); 0 l7 ]- W7 y4 V* t
document.sform1.password.focus();
: }, T% d* Y1 p: |' t% M/ N' U return false; 6 t) K" c, e4 q$ Q% f( U6 m3 C
} 6 O) P; K9 r3 k; \% C9 I& v7 A
password1 = document.sform1.password1.value; ; H% d/ n4 @& R% j
if (password>password1) $ m6 V5 F% t) a' }
{
. ]0 S' J6 v4 f; e4 a0 T3 i- v alert("重复密码与登陆密码不相同"); 3 M8 k9 _( l: ?; `
document.sform1.password.focus();
6 \4 _! }1 |0 G' q) w document.sform1.password1.focus(); " B# R8 m. X% M7 b7 _
return false;
9 ^& Z2 r0 f2 H) k } + T4 X0 | U$ {/ a
if (password<password1) 8 F, h* k3 Z8 X7 I" ~; V' J
{
, G0 X. R4 N& n alert("重复密码与登陆密码不相同"); 8 \9 G+ o2 @7 O% [- n9 D+ O2 Z
document.sform1.password.focus(); [- ~/ d! H9 ~/ R1 X
document.sform1.password1.focus();
/ N: c+ I: p3 W' c" H return false;
4 ]" ~% W2 y- i$ J; A) b& A3 ? }
. P( j+ z0 n4 w* _. C" O0 S/ C if (document.sform1.email.value == "")
5 B* \' T' `( ?0 L { 5 M! t9 Z5 U Z9 v
alert("请输入您的E-MAIL地址");
$ A2 J' M. \6 J3 g! Z' ` document.sform1.email.focus();
( W9 ~) d+ b1 H4 Z return false;
4 I8 _- @2 m$ V& S }
0 k. U/ B. q) y% ]3 t
) E- X0 h1 u: l) F& d/ l: |* S1 p email=document.sform1.email.value; ( n9 T" }( @- h7 U8 C
emailerr=0
# R1 i$ |" \5 s% U for (i=0; i<email.length; i++) 3 i9 q' U6 m X1 z
{
& P1 C/ d& D! l( u& m' v- y3 q if ((email.charAt(i) == "@") & (email.length > 5)) 5 y3 z3 @3 N5 T) R t0 ~
{
! T# p3 W. F. g$ U8 t7 h5 W emailerr=emailerr+1 " E8 ?7 G- O! n6 p6 E' e
} : G! T" m8 E+ g0 k5 Z
} r! `+ D* ^! d
if (emailerr != 1) ; U2 k# O3 G: g% ` Q" D
{
8 m9 c/ i8 s } alert("请输入正确的E-MAIL地址");
^ {+ O; M( h# ` document.sform1.email.focus();
4 l2 v0 b' x, b* @6 f0 a return false; 7 u7 b$ C/ m" U* a: Q0 e4 t
} ; Q `: x3 \! P0 \$ ~3 G- F8 V! @4 t
6 [8 `. g9 v9 _" G, z if (document.sform1.checkask.value=="") $ s6 o4 d- }. |8 L; S: U- ^
{ ) G( K) L% [& B
alert("密码提示问题不能为空"); 8 W4 H4 y. @4 n6 R
document.sform1.checkask.focus(); . a+ x ?/ [5 l ?- T# e6 d
return false;
9 U/ x6 f; R ^/ y/ U7 d6 | }
% k% b* a- }% z* y& ~+ G if (document.sform1.checkans.value=="")
: X' l% D, O, m1 A+ E { 2 L# V: G! J q* [6 k7 z% V
alert("您的密码提示问题答案不能为空");
6 K( E2 ?8 `( W# y1 D document.sform1.checkans.focus(); " r* [. A1 H6 Z( W- C+ d" I+ r; x' s7 g
return false; . b6 q! k+ J, Q% K8 t! c6 O
}
4 G4 f# c$ U, X. k return true; - ]9 Q2 d" l! x* f: f% C2 u
2 e# r$ B* X* B1 z5 a. n}
7 K* O+ R1 m. q</script> |
|