|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14437
- 金币
- 2504
- 威望
- 1647
- 贡献
- 1452
|
这个脚本对你可能有帮助:
2 U& M" @# Q, F<script language="javascript">
, H( w. W3 F: ~* L* [function IsDigit(cCheck)
% ]' L4 ?0 z; G, ^/ L9 f {
2 L' a/ M7 u, M. R$ B; K5 E& H return (('0'<=cCheck) && (cCheck<='9'));
% p& Q. f! w$ x( z. V) r4 j } / K% l Z/ }. c; o
: i! A- [* ]* n$ Ffunction IsAlpha(cCheck) 1 N0 R I0 m3 U* n2 @' @
{ ' x4 u% E# |8 _- v3 P
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ' C) B& R6 J' \3 p s, B( H ^" O
}
W6 {9 t5 I0 U! t. X
( l: H6 U. L7 d1 e! Tfunction IsaNull(cCheck) ! v6 p4 e5 W; ]" c. s
{
: }, |/ J& d4 ^3 x- t return(cCheck != " ")
$ w# B# v+ W3 v7 ~! `0 ?+ O }
- m9 Q6 P/ ~6 ?/ ~+ V# o& O3 c6 W
: Y( K! w5 |5 d5 Ifunction checkform() * _& Y) f' \8 `8 l) h
{
' j* j# R0 C( V# c id = document.sform1.id.value;
- ~! M$ v8 W! Z% R, D if (id == "")
/ R6 q) X* I6 X* y1 Y5 z7 ` {
" L8 U n' a) t2 R alert("请输入注册名"); " U+ S2 F" l* R+ S
document.sform1.id.focus(); R9 ~' V5 Q2 x& K3 x ^
return false;
' p. U+ _% {3 _$ w7 i: @+ Z# H } O9 a7 q/ P* O- l) M
6 i' q! ?( R! |! W, N% _3 c; M" S
for (nIndex=0; nIndex<id.length; nIndex++) 8 {; C) M; y( j; q, T* e' ^
{
* a) b) D% I' v8 _# N cCheck = id.charAt(nIndex);
, w9 @ l* @( I1 g6 E0 Q: w+ d if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 5 X) M. p" ~! W/ C- F3 j( l
{ ' i2 {: p/ K1 P' V* R7 V
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
0 j( t8 J7 L7 p3 e2 G document.sform1.id.focus(); ! ?0 `. ?8 A" e* M
return false;
. k! b/ R% d( W }
6 K7 A" x( Q6 i; s6 F/ ~ } + [/ W+ T/ h8 W* ]$ U, d( S* g
chineseid = document.sform1.chineseid.value; ) P6 r; B! ?/ x, [. U4 f9 u/ E/ B
if (chineseid == "")
1 d3 |/ @& {2 |5 l" Y { # ~! E6 j2 S: L- q9 I# Z
alert("请输入中文昵称"); 4 c% h$ c: L( Y$ s! a
document.sform1.chineseid.focus();
5 x; |* W0 e% t3 q J% Z( B, _3 { return false;
+ N r% Z* |1 O4 j& @9 j }
4 w% Z( ?1 B: I: t password = document.sform1.password.value;
8 h) O4 P0 Z6 U u3 S8 z" e if (password == "")
% D) x0 ]& v1 e7 F# L# C/ g {
' I9 W9 Y' k9 j$ {/ n% p alert("请输入登陆密码");
^" N$ J% G: z3 G. n0 o document.sform1.password.focus(); 4 i- L7 }% V/ s
return false;
7 S+ O9 W/ E/ R' ? } 5 l+ k: q8 ]( ~+ e; a
password1 = document.sform1.password1.value; 6 k* k4 P0 `# ~& J
if (password>password1)
/ g+ G& D6 s) f3 S+ S {
/ L5 W1 I- m" l8 Z alert("重复密码与登陆密码不相同"); 3 ?0 ^3 s; K# g! p
document.sform1.password.focus(); 4 Q6 U8 Y- ?! y g- o
document.sform1.password1.focus(); 9 r7 m" L) ?- _
return false;
4 [! ?6 N# L( R1 x# o5 m0 l } # g% {, b9 q1 G6 g4 O' T
if (password<password1) % |/ Y& D5 h6 v9 [) u# N1 x" q
{
% b" V. d3 X8 F6 \. S5 O alert("重复密码与登陆密码不相同");
. [2 X+ w( @/ _# S" I document.sform1.password.focus(); 3 O4 \ f% ^8 y. }, E6 i8 G
document.sform1.password1.focus();
$ S) A6 j2 `1 n0 \! Q return false;
' M0 g7 e# B/ h4 l0 U5 J3 w4 ^ }
6 [: I. i \- V2 m if (document.sform1.email.value == "") I) q7 [# U5 _+ B1 D
{ 2 ]- s: e; N' L/ [" o _! Q4 T
alert("请输入您的E-MAIL地址");
+ J9 H$ X9 ~0 q- a4 Z9 e0 T- m document.sform1.email.focus(); " V) O0 n6 H+ i/ L
return false;
) t2 E: r4 N! d9 O2 t5 d2 r } 2 y# |. C* s: |% S" b0 k
( R' c; ]0 v, O! l
email=document.sform1.email.value;
7 e) c y% v b/ l! F6 y! Y emailerr=0
9 _/ V2 T( u% o3 b% d: u) ` for (i=0; i<email.length; i++)
6 o* u3 m3 K8 a J6 Q' U% ~ { $ ^$ F. B7 z& ?" l3 V
if ((email.charAt(i) == "@") & (email.length > 5))
8 W- M2 @& B [9 t { * a3 @2 g% B- @8 H0 Q8 \8 S2 y
emailerr=emailerr+1 7 x: s3 |; n( i J/ t
} ! y6 c: I3 S# _+ o2 G+ {
}
" ~# R* u5 U5 ^. }: o4 z2 S if (emailerr != 1) & V9 q5 X* L6 h6 I0 V4 e
{ & c0 i/ O8 D+ N/ W
alert("请输入正确的E-MAIL地址"); , ~" P" ^6 U" e1 S
document.sform1.email.focus();
' c O. D9 f7 h0 B9 W return false;
/ `( r: Q3 c) i: y4 ]. g, L }
: ]+ z; V* B! V4 T 6 H: J: X0 H0 l1 Z
if (document.sform1.checkask.value=="") $ W' c$ I- e% n! S h
{ ; ^' N8 w# T1 k" W! j
alert("密码提示问题不能为空"); 4 ` J8 w3 q4 R$ a/ z$ |! ~
document.sform1.checkask.focus(); % `0 b& J: ^ g Z/ w; P/ s
return false; 9 W' G. d$ l6 n/ q
}
- V# Z' [2 @% _* u, L# X if (document.sform1.checkans.value=="")
0 d! k* A2 w9 i- X% _ {
E4 L9 ^( Y J( {5 t7 c alert("您的密码提示问题答案不能为空");
# k4 q) o: M6 p, a. ^ document.sform1.checkans.focus();
: j* J8 \' t, z3 A. r9 o2 T return false;
* H" d) i. V% f }
3 s: o* V6 ` n+ n+ Q4 u return true;
% f9 C" A M7 z& Z* m! b
5 N% y& b0 x9 R9 s% V. z} D; |* w& d% t3 k8 O0 p
</script> |
|