|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
这个脚本对你可能有帮助:
# m4 t& U( I8 |0 R5 y: ?<script language="javascript">
; a% m) t# j8 Z) ?$ lfunction IsDigit(cCheck) & a) l, }' l; I4 k1 `
{
( i0 i$ e$ q: l- G. b return (('0'<=cCheck) && (cCheck<='9')); - o1 T5 u$ |. r! a" c+ T# F
}
$ D% R9 c4 R- A
6 z- ?3 J* Z$ l! W9 D; ]function IsAlpha(cCheck) / ]& w6 a- T8 j
{
1 Q5 n0 t' A* `& j return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
! n7 t" `+ d- | [2 a8 Z1 u }
- D; _/ e# l+ d2 ^' x
1 B2 a( x7 g1 R6 o# A+ t* vfunction IsaNull(cCheck) ' J% b0 m' e+ V( O
{
; O; _ n3 r1 n return(cCheck != " ")
3 e( T: S1 g8 j# j0 N7 y }
j7 i5 G4 N& G4 Z
5 K# l+ A: h% k! n9 p8 C8 Pfunction checkform() I' W# `# ^, x- ?6 x+ Z
{ 0 a2 P7 e( X' W" D' D( l* k: X
id = document.sform1.id.value; 1 H* y9 b4 ~6 x! ^7 V2 s
if (id == "") 3 H. J0 Q+ V d" L s" M! T9 W1 l
{
2 ^. E5 t& h* |; f7 a' a8 b alert("请输入注册名"); / C0 o$ v+ B, v, j: }' B
document.sform1.id.focus();
5 s* S/ k8 C3 Q7 @1 I* O return false; 3 t" M3 O6 H3 X
} # C6 w1 q$ R9 F2 e, {
* S$ G4 E3 V8 k4 U- C" H4 g. e
for (nIndex=0; nIndex<id.length; nIndex++)
, e; j8 T. I0 A/ G3 l% x' k. z7 D {
# o& d: n0 }. Q! J2 V cCheck = id.charAt(nIndex); 1 r! b! F. a( p2 L: @
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) % D2 k( R9 |' v# \7 t9 \
{ 8 N! Y( x# P( ?% q
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 6 I7 p8 }& v& q7 {
document.sform1.id.focus();
' V7 Q9 C- _" c9 V: j* P" Y return false; 9 Z4 m" w: H/ b
}
) z' O0 u& ~$ X6 B* y0 B$ P } . W" e( |) t1 O( L" a" D1 J: \+ L
chineseid = document.sform1.chineseid.value;
, d! O. w5 m, Z L3 P9 u if (chineseid == "")
B& p# I/ R" q { 3 G" h2 O; X) z5 p
alert("请输入中文昵称"); ; f5 U4 H6 t8 {
document.sform1.chineseid.focus();
1 o4 j4 F( u; H. q return false; ' s& B9 \ h+ m) Q9 q! s
}
- ~, m8 n" o7 F password = document.sform1.password.value;
5 y. V2 \% ?1 U/ f8 x" i1 }0 { if (password == "")
- p/ Y2 h3 g2 p: |% K0 N; { { 8 A) Y8 A' ~+ m) T' y
alert("请输入登陆密码");
' A) f, j1 }: z( w: A) z document.sform1.password.focus(); . l4 D9 H) t" p
return false; & {( Z$ X, f" ]/ }5 E5 A; k4 M$ _
}
- z2 N. Z5 ]' y* i! W k password1 = document.sform1.password1.value;
. ~7 h" i5 R0 d0 O w5 A if (password>password1) 3 W( X8 k# W" F2 p% T
{
. @* L% s+ t# T; o. ?- e alert("重复密码与登陆密码不相同");
& H$ b7 h' T4 h: A1 H! ] document.sform1.password.focus();
6 m4 p, s2 T2 j& s6 c& Q d+ m3 | document.sform1.password1.focus(); 7 d* h0 x4 m8 E
return false;( t+ [5 c6 g) J$ d6 J9 Y- ^% A V. Z" H
}
7 ~$ d3 q. ~) f$ I; Uif (password<password1)
& A: J$ {/ `7 D* A+ S y {5 `8 k- p! L1 ]& c( G* _
alert("重复密码与登陆密码不相同");
; T1 ]8 ]5 n- O) a0 q: K% r document.sform1.password.focus(); 6 V. F" o3 F4 ?6 V
document.sform1.password1.focus(); : f7 O; \+ p9 y: }7 s
return false;! Z( e* C+ {" ~# l$ l+ r% x
} 2 v6 H! Q: `1 l" t2 Q& B. H) }- B
if (document.sform1.email.value == "") : x8 p, R, v5 Q. h6 i
{
8 }6 @! w f4 _. U alert("请输入您的E-MAIL地址");
# A$ s7 D0 P9 Z3 G$ l# N' P document.sform1.email.focus(); & f5 N9 b- m$ h! e
return false;
" U- e# I: ?% x0 v# m1 D } - `& l3 N) {7 q S8 G" W
% y: R" w O# V email=document.sform1.email.value;
: I# V; y" J# W+ t) C emailerr=0 ! r: q8 [9 j! u+ d% _* U
for (i=0; i<email.length; i++) " C# e) e& g3 E9 Z3 q$ { Q
{
) t8 G& S( `' g6 P- o if ((email.charAt(i) == "@") & (email.length > 5)) % o; p, ?0 x6 e% H5 O
{
. T: R' c: t! |3 O" F% L emailerr=emailerr+1 6 p# |1 D! }- v
} % S) r) ^1 |* H) v, F
} 6 w' q5 `) g+ `9 j3 s
if (emailerr != 1) ; \' [ @8 ]( h0 z) h
{ / a3 K% ?$ H+ ]' k' ^2 Y; c: m
alert("请输入正确的E-MAIL地址");
/ ~' o4 L; B$ U4 @' D) P8 e% \ document.sform1.email.focus();
1 G( l9 e4 G0 M5 w/ Y return false;
L0 }$ [% |) I }
6 X7 g, {( q' A . q3 H, @$ X+ c; d3 a+ Z
if (document.sform1.checkask.value=="") : v$ i! P U* d
{
0 f) I2 X) E, u. X alert("密码提示问题不能为空");
9 n0 Z: w- E" R document.sform1.checkask.focus();
3 h$ Q7 ]* @2 `2 C return false;
1 i' c7 V1 |/ L }
7 `4 V0 U* V3 B3 n( \ if (document.sform1.checkans.value=="") : [( b0 B* v# r, d, u6 l
{
/ B1 \6 p' U4 T alert("您的密码提示问题答案不能为空"); 5 N* i* n8 U2 f; @# s
document.sform1.checkans.focus();
! y2 p: M c C2 F# G* @! a return false; + o" u' \5 ?' H: y# R
} R$ d1 L# p! e4 a- Y! _6 E
return true; % V. B2 F' q7 o: ?, m' y# `
. r6 I# V6 g6 A' V8 M}
- u2 W; G# }1 ?5 k9 z" p5 ~</script> |
|