|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14367
- 金币
- 2469
- 威望
- 1647
- 贡献
- 1417
|
这个脚本对你可能有帮助:' ?$ k* J: \4 f
<script language="javascript"> + r, X$ ?! X" ^8 B9 T) D7 G. e
function IsDigit(cCheck) 3 z9 G! s3 ^* M. b
{
C" j: F7 [( Z5 Y8 p" K" @ return (('0'<=cCheck) && (cCheck<='9')); . O2 g2 V) I$ j$ _' o2 a
} : s+ _9 ~. s5 t; y+ }
X4 n6 W, w3 g. F
function IsAlpha(cCheck)
; }3 q1 T: \3 F+ }# h! e {
) C6 L+ O. T0 f return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ! e+ O/ g# L7 S# w/ ]
} ) _0 I- F7 v. x- p5 ~" D. |
/ K" m0 c o8 N# J( _: qfunction IsaNull(cCheck) / V9 i% {7 Y9 Y$ T3 @% ~/ Y" B2 }6 P b
{ ! j+ k _* x+ Z3 f& n, Z
return(cCheck != " ")
2 n9 A O. f+ C8 U4 j" H) _ } 9 I# {( ?$ X: w+ Z9 A9 g6 d
7 S# {8 P3 y$ P. h5 f4 f) ?
function checkform() . u% \2 z! { a
{ ; j) z4 b8 o# E! D/ z# `2 n* d9 l
id = document.sform1.id.value;
5 |/ c' y' I, t) M) V( S" J if (id == "") 7 d/ y( R; n0 ~. ]
{ 9 A% D7 s% H0 ~# ?' V
alert("请输入注册名");
6 f/ F! G8 y- M7 [5 i! r' n9 ` document.sform1.id.focus(); 0 K5 Z U! M) ~, Q$ S& I
return false;
7 p6 F- S1 r5 T } ) k. p9 C7 D0 j% A
V$ D0 D- Q- a: R% }
for (nIndex=0; nIndex<id.length; nIndex++) ) ?6 M# k6 k% s. e
{
: ^4 h7 Z5 A2 ~4 X0 `4 X( L9 `. m" h cCheck = id.charAt(nIndex);
7 ?# I. m+ ^" Z! i; t; [ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
3 W& I. @' S! n- ? D- H/ W { 1 G2 |0 L+ \) e3 o1 d* Z
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 4 I$ M4 o# t$ Z" p
document.sform1.id.focus();
Q$ F- l; J Y6 E return false;
4 j& e6 q# V, X9 D# Y1 U } * c" q9 n9 O6 s" r3 ?
} + R; k8 }4 M) o6 k' |- L8 x
chineseid = document.sform1.chineseid.value;
( o/ ]4 F% {- ^' z, | p. T+ v if (chineseid == "") / o% G1 H3 T6 x
{ + U' ^5 D( [: S% Q; z m
alert("请输入中文昵称"); . {2 }2 S C0 E9 D
document.sform1.chineseid.focus();
$ J. C0 t0 A/ L0 q return false;
, V! \: @ c0 B9 x! V' ] W+ X6 l } . i4 N( U9 n6 R' H
password = document.sform1.password.value; ; k* H9 I6 w5 t1 Q7 A, z# A
if (password == "")
1 ?! P6 U1 A" F5 {. T$ H {
4 F9 I/ x* X8 l+ X4 a8 I j% v alert("请输入登陆密码");
! h& T' h( Z {+ H& [5 g6 |9 \6 n document.sform1.password.focus(); ! k% X$ x2 `' B1 `; C( ~$ _
return false;
# e; j' @( _" w: F. e }
+ F$ T* t* o. L: |5 ]* A) K1 v! z: l password1 = document.sform1.password1.value; # U, ?$ G" v: P' Q( |. U
if (password>password1) 6 l* U/ u. N) H- {7 D0 l
{8 |# n+ y1 w3 i* W2 J) @; ?# \1 j
alert("重复密码与登陆密码不相同");
9 H5 I& d# O+ B$ S6 p, m document.sform1.password.focus(); 2 V/ e. H& k$ F2 }: O
document.sform1.password1.focus(); , |: o2 E9 }2 G. c7 e
return false;
- d; _( P/ ^$ K p7 q }
6 T D, t+ Z" O7 u, ^( Q7 iif (password<password1)
- L# C0 A! _1 H; w9 ?/ X6 T {
& e1 D% k: G6 U' P; h alert("重复密码与登陆密码不相同"); 9 ~$ I6 u6 u& w) R/ v
document.sform1.password.focus(); 0 o" w/ K+ K F h: n
document.sform1.password1.focus();
" l* \9 a& i8 @( a' p) A1 I return false;
/ `( w/ A" Q1 T) ~2 s5 i }
+ z, v2 y' f2 A. D if (document.sform1.email.value == "") 2 w# y3 W: a2 ^* J, h
{ $ d; e! n" }4 ^$ O& D! V
alert("请输入您的E-MAIL地址"); & U- `5 |! c" {, d5 J
document.sform1.email.focus();
9 K9 q# U" D0 V return false;
* P: ` Q2 B3 b, ^1 Y' ?% F2 u }
) f4 @! Q5 m- j $ B* r. ?2 \+ F! Z7 |, S
email=document.sform1.email.value;
s3 M7 O& O2 B& b4 A+ R& s1 M emailerr=0 * M0 J# [: D0 q' Q/ a4 G0 \6 M! h
for (i=0; i<email.length; i++) % K: a$ k9 s/ K1 H+ E' t
{ j4 E" H8 N! {9 i( n
if ((email.charAt(i) == "@") & (email.length > 5))
7 n4 o9 ^/ h# V' ]$ O3 W, Z+ m7 H {
0 f/ S, P$ r# U( } emailerr=emailerr+1
# F) @0 ~+ k5 H- q) i } 0 s, ^. o1 U. p" ` ^
}
4 l8 [ s+ k* _( @" \' _. I0 l if (emailerr != 1) 5 `) c' y7 u0 D( F s
{ + `. Z% B6 J3 _/ W- L% E
alert("请输入正确的E-MAIL地址");
2 x% r, z0 k A' ]" F/ L b% P document.sform1.email.focus(); . z5 w' @5 H. v2 z# v8 }! v1 y
return false;
1 n* q6 d6 }3 r, K }
0 K" u( k: [/ w6 ?* ?5 J + A3 v; C: k& n
if (document.sform1.checkask.value=="")
0 w p- G7 x% j4 z {
& _! _- W% O- F7 r alert("密码提示问题不能为空"); % N! q& H' e) I
document.sform1.checkask.focus(); " }$ l( {/ e1 r/ `" B
return false; # Q1 ]& W3 S/ q5 X
} ; e8 S* x) Z1 M
if (document.sform1.checkans.value=="")
9 G. W! w* Q( v+ y8 r { ( c& E3 Q+ v& H& H1 ]! L
alert("您的密码提示问题答案不能为空");
/ _; p, q8 z% T9 n4 v document.sform1.checkans.focus();
& ?; y9 c( @4 C, p1 V return false;
3 U% E2 D' y; B }& s% d! n7 ~( e* q
return true;
* ?" G g1 P: G4 [
& W4 u- h3 \4 M8 E' V6 n} 4 K' x" z0 j" U K; m! {4 _* k2 H
</script> |
|