|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14371
- 金币
- 2471
- 威望
- 1647
- 贡献
- 1419
|
这个脚本对你可能有帮助:
) h* ~- O: c9 \9 o J* f t# J<script language="javascript">
* m7 f# W9 r! u8 Nfunction IsDigit(cCheck)
. ?4 l* a7 b0 ]6 z8 x7 A { 2 ^: z2 f0 ^6 A8 K
return (('0'<=cCheck) && (cCheck<='9'));
5 L& s; H) Q! t; A3 d' _! b0 E }
2 V. ], G; D6 W; A % G/ a/ k! b0 A+ ^; N. F: S: Q
function IsAlpha(cCheck)
1 m$ K4 x t8 B' X/ N { 4 H9 n+ ?3 d0 H" p; C4 Q4 x
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 V5 p! q( J. i
} % R7 i; P' _+ r, d$ H$ q* R6 y
+ ` ^2 {% }5 g! l5 h+ vfunction IsaNull(cCheck)
6 F! m" i5 T$ Z; y& B1 b; H7 P2 o/ t { $ g7 N% x- E7 t' g1 M8 q
return(cCheck != " ") 3 o' ?4 g8 e; _8 B# t
} & i' l# B5 h4 t- \
8 C; y, R+ a; i# B! q" [( S) {
function checkform()
0 k: o) R( | J{ / o1 [( L( n& C P5 E5 X- c: @4 I
id = document.sform1.id.value; 9 B4 N9 }" k/ `0 H. X4 U; r3 g2 q1 e
if (id == "") 8 V- B5 C) p/ s" E7 u ]* T$ b/ h
{ $ B) X: C7 s1 R/ a
alert("请输入注册名");
6 d8 a2 b) g" ?$ `; S: }; a document.sform1.id.focus();
( B0 w8 T- e. K return false;
/ o' J' V% D) h: z1 }! D } " z- A0 Y# L6 j+ l& m. H
$ O0 A8 m& {. O6 I. y
for (nIndex=0; nIndex<id.length; nIndex++)
9 V9 C+ ?6 i/ X/ B% ]5 K {
* m5 R# @$ k! \0 Y% d' H4 k: o; N) t4 L cCheck = id.charAt(nIndex); 6 h3 Q. K; g R- F( d8 `) A
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) * ?% ?. _4 \! B) X
{
" O' E: J* U- s- K) {4 A alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
2 t: k8 _, Z& l: b4 k+ @* x document.sform1.id.focus(); Q/ p2 F$ B b! ~
return false; * D+ c8 N6 {$ X+ R) T) W6 a/ F
} # Z3 u4 y' q% }7 A: X5 o8 R) B
}
+ h1 R# _ J! @* c3 z9 V$ Y chineseid = document.sform1.chineseid.value; ' h) f. ~6 m6 q9 U/ g0 w
if (chineseid == "") ) C7 i4 p$ v- c+ w
{ 0 \: j. w2 e) N; {8 a
alert("请输入中文昵称"); . a- g5 [2 \- W/ r$ h8 ~
document.sform1.chineseid.focus(); 5 l0 E. c/ ^; ?
return false; ; u4 A9 k4 f" x
}
8 v" r; Z& d7 u* E. ? password = document.sform1.password.value; 3 H; B: S0 u$ j
if (password == "")
7 F7 H! N% n( t+ }5 k* F" } {
* _- e* b* R" z+ I$ {6 G3 O alert("请输入登陆密码");
" f4 t( Q+ B D( Z document.sform1.password.focus(); 9 g+ O& U. t& Y
return false; & R8 F8 ]4 ]7 V: n
}
$ t& T; A! z: U9 P password1 = document.sform1.password1.value; 1 o0 J( O9 M2 _1 P* o: g9 `, J
if (password>password1) $ d3 O8 K2 P5 R2 ^, R; n: g6 U, K
{* t' r! W2 d( d2 H
alert("重复密码与登陆密码不相同");
! `% q/ }: E1 ~ document.sform1.password.focus(); 0 t2 l3 P' [2 Z0 F V
document.sform1.password1.focus(); # y1 L: k5 m, I; o& U/ F
return false;
4 t+ I: u! ~6 v, T+ u } 5 n+ a" {# m3 v. y" I% l' h
if (password<password1)
" A- T8 @% E7 t {! Q5 q8 v# c$ l: t9 S- L, {
alert("重复密码与登陆密码不相同"); p+ C5 @0 g% D% u9 |4 u1 ?
document.sform1.password.focus();
5 z9 n' N/ F$ L3 R document.sform1.password1.focus();
7 Q( Y/ O+ i. T' ]; x return false;
# V& L: f+ }7 d- b2 i } 9 Z( @; G* H R Z0 t) D3 `
if (document.sform1.email.value == "") , C* l( x) W3 B1 M5 \+ H
{ 0 m+ r/ b$ O4 u' w' ]
alert("请输入您的E-MAIL地址");
2 f9 k( |) k/ \3 N3 ? document.sform1.email.focus(); ( B- i. ^) }% W- I, ^+ y
return false; 9 Z3 Y2 s6 u' T: |7 P/ k: y
} 0 ~3 l R: N5 ^$ R! q
: r! s- T& y% W9 c7 V" w email=document.sform1.email.value; & r" U% x/ S. R7 |7 C) O' ^9 Q
emailerr=0
8 F F4 u' b( u1 U for (i=0; i<email.length; i++) - Z; X2 m1 F( P! ?1 ^; _
{ . m2 [- |6 \- |" J Y1 s# `
if ((email.charAt(i) == "@") & (email.length > 5)) & T, M: |& R3 y3 s) f
{ : {/ w- h/ P) R; F6 y, b q
emailerr=emailerr+1 ' d/ i% T/ p' k6 v: R# N
}
) W9 {; b; _3 `! S/ E2 F7 Y } " X( p/ O2 A/ L! {
if (emailerr != 1)
2 @. H6 q2 v" d' S) M5 P: v$ D { 5 s: `7 B) ^( C$ I
alert("请输入正确的E-MAIL地址");
, t" |! g8 @4 d$ F8 C document.sform1.email.focus();
- [) ~, P; g& P9 J: U7 A+ T return false; & @5 x$ {% U/ h0 k0 ^
} ' A4 q3 O! ^: N: }- A) N1 j8 Z
) n" j) ?6 B. @ |0 F) P) G if (document.sform1.checkask.value=="") ' G& n& o8 V8 @; b
{ ) q' H7 a( m: g- x
alert("密码提示问题不能为空"); % R" z7 u( j I" x0 I
document.sform1.checkask.focus();
! e) m4 F p# r: [( V! f2 v* \5 V return false;
. K* ]% V7 a# s4 S }
+ I% |( S- D8 T- V" b if (document.sform1.checkans.value=="") ' ]7 }9 j( r1 g/ n& c. m
{
9 d/ ~- d7 E+ }/ C- t2 v/ V alert("您的密码提示问题答案不能为空"); : x* N) A# w- m$ u0 z0 {/ P
document.sform1.checkans.focus(); 4 A* d# n3 ]* A' M0 e
return false; 4 }# l! d& z9 ?2 l- d* @% E+ m. O
}
& d& r1 }: L+ |0 c1 d- t$ R. N return true; 9 }# g# a- J' f& T& c3 G" U! K
/ I1 E9 m" m, z ~. L. I} * Z( W1 a8 v7 x* ~+ K9 v
</script> |
|