|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:9 L% C( t& A# ?1 v; B1 @; D
<script language="javascript"> + ~% C4 P$ H: ?6 `, P
function IsDigit(cCheck) 3 e" W8 v* I1 b* f7 C3 \
{ / \2 L! q# c, w. s- _
return (('0'<=cCheck) && (cCheck<='9')); $ Z7 ]2 Y. s% g' P; G8 y* Z
} / x6 U! H/ D& y S8 }; |9 J
1 j7 |1 R8 z4 B/ H2 d4 Cfunction IsAlpha(cCheck) ( G5 y: L* Q) _7 F) o
{ $ e: O- ~/ T2 ]
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) d; J' ]! I- [* g, E
}
) A- m) j- {+ P$ D6 z6 J8 i7 h 4 `1 V3 i5 x* A1 k( o& ^+ {8 ]- n$ a
function IsaNull(cCheck)
, @% L. r+ l) i1 t {
: U8 |% T- j& M6 M return(cCheck != " ") ( g: z$ i7 q$ ~
}
: @" S: V! u! ~ ) k* n3 |4 g) n# g D
function checkform()
' a z4 _# x- F( E7 `6 Y2 e{
0 S& @: s( d$ X! t id = document.sform1.id.value; - m! t/ g# t4 K, P" y; ?: j& C* j
if (id == "")
* I t: [$ V, b2 }- g O { 9 H4 J& G# ~8 J' S5 q
alert("请输入注册名");
0 b; F2 T6 {4 D document.sform1.id.focus();
5 n+ s3 @! v i0 x. O% `/ f% E return false;
' w& D C6 d/ k% v/ d# F } : n7 {0 @! R! t- [$ g
- N! g1 ]- t# U4 U. k% R P for (nIndex=0; nIndex<id.length; nIndex++) + r9 T/ J2 o5 |- n$ T
{
5 D9 {" X% k7 f) i/ ~* E& J9 i cCheck = id.charAt(nIndex);
0 j7 z% g$ x: Z( L9 w7 M if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 7 |) i( @4 r5 p5 v( R
{ 2 L" @" D ?: Z( n7 J
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 9 |, h+ ~0 ]7 C# @1 {* K+ _
document.sform1.id.focus(); - {6 p6 A+ X( K; D4 g4 N
return false; , ^0 @) C) }- t" |& C
}
9 q* u" U* s! ~/ _% S } - m j( A0 |6 K* f2 @. k
chineseid = document.sform1.chineseid.value; 7 j- r; s$ [0 u, Y
if (chineseid == "")
% C3 e* i: F6 M9 B { , |2 f& K4 r$ x4 f* k9 @* w
alert("请输入中文昵称"); ! i' Z0 X! o8 {. w/ `
document.sform1.chineseid.focus();
" k0 f2 G' y+ I return false;
' ^& ~$ i$ k0 S1 k. B# \ } J, |8 ?. Q. T$ D! v2 @
password = document.sform1.password.value;
- L4 a# h" e: m if (password == "") # j! S. s; E( I, K p9 x2 B
{ / ]# t8 x, O. {! y% j3 q5 i
alert("请输入登陆密码");
% N1 r3 ^+ B |- k z document.sform1.password.focus(); 9 Q! i3 X5 W! R( N; w
return false;
8 g! R% D% H! w }
5 Z# T, [2 J8 ]/ d5 u9 z password1 = document.sform1.password1.value;
. f7 _5 Q' C- y& }: L' c8 ] if (password>password1) ' g& @" s' F( ~
{
& `8 U& B' u+ I; O3 G$ T- U alert("重复密码与登陆密码不相同"); 3 ~. w% |; ^8 T$ J0 }" H
document.sform1.password.focus(); " H5 a7 G% ]; t2 l
document.sform1.password1.focus(); * y1 G0 g. F7 f
return false;+ T0 F) w0 u& G
} # K @- G* p2 o. m/ n4 z+ L
if (password<password1)
& n# V+ |5 b6 z0 w% p {
* S4 K* m9 B, f5 K' L alert("重复密码与登陆密码不相同"); - S6 f! \9 Q3 h; @
document.sform1.password.focus(); 5 {! b" O% {/ g, d c7 ?6 @
document.sform1.password1.focus(); + K% d1 q" `' x6 G
return false;0 s5 j( }& f4 z
} * L9 ~7 i) Q, t4 Z/ E1 P
if (document.sform1.email.value == "")
^$ e* B8 H3 Q# j' P: G {
! P0 X% A5 B2 E1 X4 M6 ` alert("请输入您的E-MAIL地址"); * q: D+ p- J+ Y; `+ N0 ]# Q+ L
document.sform1.email.focus();
$ J9 B. @6 D! p7 Z: p) U9 o) b return false; % S2 m' @7 t1 C4 Q/ `+ s* e0 b$ ?
} 1 V! f. T8 X# M e8 E2 f" S
% v3 ?0 N! k5 X. y$ H, T
email=document.sform1.email.value;
$ D) X+ w3 e( C$ _9 n emailerr=0
9 ^8 R0 f" B+ t* |! \/ i for (i=0; i<email.length; i++)
0 P2 E! r* P+ \" d! h; r { 9 S. ~9 D9 Q' t6 S' ]6 r/ ?
if ((email.charAt(i) == "@") & (email.length > 5))
7 t- ?* z! D" u3 @6 S8 f# i3 W3 C {
1 l' M' x3 E5 g; {8 P emailerr=emailerr+1 & P t4 g3 ~4 ]
} " H4 i; @* x. F2 }' }( ^ f
}
7 b. F c2 P9 v U if (emailerr != 1)
% s E2 b/ P; x# z( F G {
! c# G, c) Q" A0 X alert("请输入正确的E-MAIL地址"); + _6 e+ s+ g5 j% N
document.sform1.email.focus();
8 `/ K' R3 D" H/ L1 L) p return false;
' c( m* I* u0 X+ R }
0 W6 Z" j" v* p5 }9 G
! K/ Q# c) k; v if (document.sform1.checkask.value=="")
) E; U3 R8 P7 b: }8 L6 F$ b { 2 }* Q/ X5 P7 r# f1 F' b/ W0 \
alert("密码提示问题不能为空");
- T% `3 n6 X7 X: x1 {7 W Q document.sform1.checkask.focus();
& r$ T9 v0 r% p1 g return false; % h$ K" P! j4 b* w7 F8 F V6 j
}
. t2 D- ?% I i2 C: ^2 b1 N if (document.sform1.checkans.value=="") / S5 y) l% g, e+ `1 p4 y
{
- r( v, I# _8 T! i3 A alert("您的密码提示问题答案不能为空"); - C2 |* P) D+ i0 A
document.sform1.checkans.focus(); $ ` r7 V T- X) c
return false;
3 d! S7 ]; R; L! j5 i }+ ?4 `: ^$ @" k2 m+ g* m& n0 a
return true;
9 z) N$ s+ a9 f* b& ^1 ]* r: A% `+ e
8 i* w6 }! a7 s$ R' D3 ?/ {% b} 1 l- [0 m( ]; p0 s6 V1 @4 W4 q
</script> |
|