|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14329
- 金币
- 2450
- 威望
- 1647
- 贡献
- 1398
|
这个脚本对你可能有帮助:
& V5 O3 V& B& l. j. v" b<script language="javascript">
N- Q# A# W' X) Efunction IsDigit(cCheck)
6 b* j- j# u: N8 o, P {
$ g; Y3 E" a1 L8 b# M4 n return (('0'<=cCheck) && (cCheck<='9'));
# C4 e+ m# D9 K* y' M- M4 X }
" d: y5 X3 ?: R 1 ?* _4 B' E1 N/ Y* |1 v
function IsAlpha(cCheck)
0 Q! g) z' `3 u! R2 h! P/ K6 l7 V {
8 M. [+ N4 o7 p) ~* W return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 P- o: N' ]& K- w- q
} $ G( g7 ?8 p: W% f" Z7 X
, \9 a+ O0 l* C' V( f" o5 f
function IsaNull(cCheck) " n3 M. U2 j6 @% E4 \, ~+ ^: o
{
7 |: d2 O5 p( s- d+ h b0 L return(cCheck != " ")
9 O/ G6 `0 Z; [9 D3 l. B } : n8 l8 `" u4 N" o- K
$ w" o0 F! x9 r; w* t; G" C# r
function checkform()
; p) C0 J5 M2 w/ n5 Y2 a9 h{ " ?1 W7 B, w ]8 @! x# B8 Z D
id = document.sform1.id.value;
4 w2 F$ F6 O' I" N if (id == "")
1 z0 e) U. O' I, `8 A/ n2 Z$ ? {
7 V) \+ I/ d( Z2 b alert("请输入注册名"); 4 f _3 O% R* ^0 V
document.sform1.id.focus(); . V' C: H5 Z* v8 `5 N" X
return false; 5 {4 P; \8 J( Z+ d6 y
} ( q3 m8 q. Y1 R$ g3 ^+ D6 N3 p5 G
* P3 w5 r' E: a' G0 p
for (nIndex=0; nIndex<id.length; nIndex++)
8 l" ^" M. l, k# l1 y3 N {
* S/ X8 c6 K+ }: R- l+ M0 \ cCheck = id.charAt(nIndex);
& \! m& z; ]* A2 @1 Y7 ^ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
( o: y8 H7 }* |; A4 u { ! w5 k/ t$ C, s( \
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
& K- _4 c1 |" l3 h document.sform1.id.focus();
4 z7 R6 B8 {1 _3 @ m4 N+ } return false; " }: f2 k' Y1 W! m
} 4 e2 i- D/ u: g
} 3 w$ ?* T9 l+ K6 |, K% E
chineseid = document.sform1.chineseid.value;
( F3 q$ l7 Z {; o7 ]& u; ^ ~4 c if (chineseid == "") $ B5 o. }% O$ k% e. o
{ ) q# L, O3 M. L6 |' O4 Q( L0 |
alert("请输入中文昵称");
$ I1 s: N; u# ^$ o+ k2 E document.sform1.chineseid.focus();
& H+ {( E6 s- w return false;
3 W9 U4 A( j5 z" x# r }
+ h$ W, U. p3 I5 Z+ {( o. | password = document.sform1.password.value;
# X( \) O$ ^" ^* q' `6 _4 U if (password == "") ; V5 i- Z4 a7 L7 t. w) {. O
{ 8 N, E$ S0 {: a4 s( e7 ~5 O8 _* e
alert("请输入登陆密码"); 8 x/ A0 w9 z" B( z+ }
document.sform1.password.focus();
& u6 f* G6 [. S; M4 b! g+ J$ k, ] return false; 7 s: w, C+ g. @ M; l
} 7 M) v2 X+ b% u m4 k+ E8 Z' F
password1 = document.sform1.password1.value;
9 m: |) ^* R$ z! f; `5 ^8 c if (password>password1) 8 c7 n, t- R, T. |+ f7 Z- G
{5 |) h: A1 @- k2 D* Q
alert("重复密码与登陆密码不相同"); 5 ~( a9 L7 P6 I- q/ C: q" ~
document.sform1.password.focus();
$ G: ~6 z' j% F$ b7 ^# A0 c document.sform1.password1.focus(); , j k* s J* H o6 G
return false;
$ I. g( k+ X& ^4 ?, l0 e } * B1 r& l' J5 q' Q
if (password<password1) * [' c! s3 {6 {/ B7 Q
{9 Q! y( x1 {$ \- w* f9 Z4 z( p
alert("重复密码与登陆密码不相同");
$ s% i8 O( m( U document.sform1.password.focus(); : p3 G F4 c; p8 }
document.sform1.password1.focus(); . M2 ^' }' U: w# F5 W) j7 W: R
return false;2 u. o3 `/ L) Z. N4 z7 ?
}
( d- U3 @/ r1 C* a" g if (document.sform1.email.value == "")
$ K9 I% u0 M- W6 Q# h! q7 K { ( m8 i" j& t5 \5 w1 g
alert("请输入您的E-MAIL地址"); 6 j8 F; I4 N: \3 |0 l C% d1 S+ G
document.sform1.email.focus(); " p _$ K9 K) Q: q. {4 b3 ~
return false; , h1 a5 ~3 F3 t% X& @
}
1 Z* F1 g/ s1 @1 z2 _
3 @4 K1 F3 {3 d) v email=document.sform1.email.value; , \( C5 h4 S. N' \
emailerr=0
' U( D+ ^, l$ T4 c5 C0 t& h b+ z3 s for (i=0; i<email.length; i++)
! R, Z2 }7 J7 R0 Y. J+ a: O1 T {
! b/ d) n. a. b- [ if ((email.charAt(i) == "@") & (email.length > 5))
7 W$ Z0 F# `2 r/ [7 H" L {
6 ]6 o9 Y" W# r- v6 W: _: w, @ emailerr=emailerr+1 / s3 b- l# s: M* Z' X2 Y# O
} 0 A8 [% t' k# ^7 Y& }1 K8 F
} ' Y M/ y1 I3 K5 z" V" g
if (emailerr != 1)
2 Q2 C! A8 w! y& a; D$ H {
. H) a8 x* F7 m1 X6 s alert("请输入正确的E-MAIL地址");
; I- [. C" x# L document.sform1.email.focus();
7 e: l3 R/ C. l+ e return false; ' q5 A+ i) }" u3 }, s9 w: p
}
) @5 a3 }0 Z' l8 r5 T& _, J3 j : R% p; _) ?# c* ^
if (document.sform1.checkask.value=="") 2 K4 g: T" b: D& y6 H& n" V7 w
{
- ]5 P/ T+ q$ m& Z% e alert("密码提示问题不能为空"); ; f# [' O2 {5 F6 s/ R
document.sform1.checkask.focus();
% m. t( j8 K& [* G5 I& M G; r return false; , P2 K* Q- r7 k e7 z- p' F
} - s( ?5 o9 U7 X% u
if (document.sform1.checkans.value=="")
% ^1 c! m& i8 S { 2 \4 c3 I, M* B0 p2 D6 O
alert("您的密码提示问题答案不能为空"); 0 a) V2 _% k# l! }, q; I. ^: ]
document.sform1.checkans.focus();
5 z% S4 y: _- V9 ?6 c5 [ return false; + L* M9 p0 C9 s: b1 A# b5 l
}
0 m. I( ~$ o! S* Q$ Z5 t, v1 l return true; 1 W7 L: c; F6 E, n3 ?
0 b' I$ M8 @! f/ \ I" l+ j; x}
8 v; v3 i5 A, e2 I# Z& J</script> |
|