|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14355
- 金币
- 2463
- 威望
- 1647
- 贡献
- 1411
|
这个脚本对你可能有帮助:
b$ E! L1 a, {) Y: @4 x<script language="javascript"> . a; k z7 C; m7 F7 x
function IsDigit(cCheck) 9 Q0 S9 t- @: f' g1 R3 q' B- ~
{
, |# u6 @. |' y5 p; E! v! e return (('0'<=cCheck) && (cCheck<='9'));
1 C! q" i- \; r }
H! A8 i& [$ q/ l 2 a1 o5 ?% a, F
function IsAlpha(cCheck) ; D* K3 H" D) m7 M
{ 5 Y+ f$ ~: X5 f) d/ K7 n! O) a
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 3 e7 b, F& }9 W0 C$ r
}
" a" q' w: r! F7 [4 S, l9 X3 y1 W
0 Y# A, {: P- |$ j/ pfunction IsaNull(cCheck) $ P! f) r) n3 y+ [0 V: L
{ * A) j0 W& y8 L/ `+ }
return(cCheck != " ")
2 @, U0 E5 I# r2 p! X }
" b6 u4 i; e8 k6 i; q" h o+ W. W , q' s1 \" v6 C6 G5 l1 l
function checkform() * q* C2 ^9 U; _
{ 2 E! f }7 J3 ~* V( o
id = document.sform1.id.value; , x- J5 P3 j1 |7 A5 y8 O( ?
if (id == "")
) z; I$ [8 p9 g { 1 H$ i. P" M# l; Z( _8 T9 U
alert("请输入注册名");
7 N# G. ^% j1 o: Z document.sform1.id.focus(); , D# x8 ~8 y: `# }5 {5 Y1 n
return false; & d' m2 ~5 W8 O, ~. ~
}
& j9 z& T) x1 w3 d2 U u0 F' S; v: V, U, s6 h: {& r
for (nIndex=0; nIndex<id.length; nIndex++) 6 j/ p# J6 i% V
{
9 S1 B/ @& ?4 x& W" u cCheck = id.charAt(nIndex);
6 I7 G* o7 o* @" F% d. e) Z if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 6 ^- v: ]7 Z2 Y: C* k: T% P. n4 C# F7 N
{ 2 J3 g) d" o# \
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
% e$ ]" O& N: d) \ c' J/ b# @ document.sform1.id.focus();
) r( _4 Y5 J K/ R; I2 z% ] return false;
$ s' r' q/ Q2 B( q! A } & \9 G: c+ P- W' _
}
( V( E/ E0 `' T chineseid = document.sform1.chineseid.value; , V( y# ]! N, X0 |1 Y0 S
if (chineseid == "")
7 p7 J' i4 s+ w6 { { 6 T7 y" ^+ o& ~9 F0 v
alert("请输入中文昵称"); $ e6 u5 W5 V$ h
document.sform1.chineseid.focus();
1 {" y. P) M7 `0 V return false;
! R8 L4 c; T1 ]- B }
$ ^, Z. @9 x: R; s. N+ z y password = document.sform1.password.value; 5 B j+ i. _2 G
if (password == "") 3 |% G6 Z9 x7 H% `% Q
{ 4 {8 J0 f8 V/ w% {
alert("请输入登陆密码"); * j }7 S& y3 [' l# Z. O
document.sform1.password.focus(); & b8 g( h* ^7 M+ R4 t, H3 ]
return false; % p1 Q( w+ p8 M
} $ p) \3 {2 B/ @. c4 U- u$ U/ F. h
password1 = document.sform1.password1.value; , D) `$ v$ j& v. [( B
if (password>password1) . \: } U4 t& C1 Y' T# p
{
( \/ p; ^: t+ o X: M* X2 b, d alert("重复密码与登陆密码不相同"); " W/ a4 H. `. Z
document.sform1.password.focus(); 3 `. f) ^6 I0 s
document.sform1.password1.focus(); $ ?( A7 b3 U" d
return false;) g3 M% m7 J5 b: M& I1 n0 J3 U
} ( A7 y" Z4 c3 V- E( q- i f$ x1 n
if (password<password1)
, X0 ~% [) ~) ]- {9 _0 } {$ Z3 W, x- {5 F
alert("重复密码与登陆密码不相同");
- A% \' b& l# h! l5 }9 Y- W+ P document.sform1.password.focus(); , s& O* ~. n9 H3 f
document.sform1.password1.focus();
' D$ I9 z0 u- I: o return false;* {1 ^. V3 L# ?6 t2 p; h' q
} 4 \/ Q6 N1 `& u5 p3 A
if (document.sform1.email.value == "") $ B* N( ]8 W. ~3 [- C" S8 d
{
) }( M; }- c% R# s K alert("请输入您的E-MAIL地址"); : I2 }0 S0 K4 n% h
document.sform1.email.focus(); 9 O5 G3 F9 c7 ?2 e
return false;
8 w% C3 H- ]5 } } - Q9 v2 {( L0 c5 k8 c+ M' Z3 v
7 T) F4 Z: k- ~' \, r$ C! ^
email=document.sform1.email.value;
3 g. E% ] @5 Z; j4 m4 F S emailerr=0 # Q3 b+ i2 D! H/ V: z6 z
for (i=0; i<email.length; i++) # v9 d7 B! c$ @
{
7 V4 o, c3 |0 S5 h if ((email.charAt(i) == "@") & (email.length > 5)) # @- N) b W+ D% x Y
{
% Q9 D# \/ m) p' ?+ Y emailerr=emailerr+1
" v8 y/ r$ [: L0 b. Y }
% P) j9 |5 V2 {2 h }
8 Z, Y) L2 h/ ?2 g if (emailerr != 1) - ^0 y. z/ T; M7 P% E+ J$ g
{
: d- l& Q5 Y- w' Q alert("请输入正确的E-MAIL地址"); 6 a! y9 N+ ~2 [ \
document.sform1.email.focus();
1 _" m: O2 r/ o1 q" t7 o( o. p return false; ]7 W; z9 [& }+ Y+ N6 X1 R, L
}
" U! x3 C4 t! j! O
, u4 `, U7 C) \( ]0 ~$ H# A if (document.sform1.checkask.value=="")
& ^$ {3 N" N) p9 z2 A { 3 G- s$ b! Z4 H* S" k! ^+ w
alert("密码提示问题不能为空"); 8 ]2 X- _8 ^+ \6 r4 K3 a, s
document.sform1.checkask.focus();
. n5 X; Y/ J- b7 I( z. s( l return false; 9 Q+ e+ f/ e; ~' R2 K
}
, I3 q7 C j8 A1 v4 v& J* i if (document.sform1.checkans.value=="")
/ Y6 ]8 X- {- J b4 O! S2 |6 T: s { $ x" k/ Q6 c/ M
alert("您的密码提示问题答案不能为空"); + @! ?% y% R) l( @0 R
document.sform1.checkans.focus(); % N# [6 e3 @4 v) V$ X0 l6 |
return false; : c, q9 Z6 P3 W9 r5 ]
}
8 F9 ]$ W8 N1 c& i" g return true;
) s9 G. U8 ~' }; ` # ?: b/ N! H R4 @, s: D6 R6 _
} 0 b; J H% ]/ q
</script> |
|