|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:
( U7 z% P1 Q, c* Y- u<script language="javascript">
7 A7 P" O. p% dfunction IsDigit(cCheck)
7 w. R+ c/ ?, }- ]1 T/ B0 A' ~1 N { ' D( B: D2 n' g1 z5 u, _# w
return (('0'<=cCheck) && (cCheck<='9'));
; M4 S% t% S9 C6 q: f6 w' E } ! L6 b# p; x1 Q& A; _) y
; w' k7 A! O" O7 {
function IsAlpha(cCheck)
, P- O* z$ r7 y6 I H* I+ W% E3 S {
0 c( y" F$ L- e6 G6 X return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
; W' N, H$ C; h, ?1 Z( @- N }
- |+ p( n8 @0 k 0 N% x3 [1 Z) b. q0 D& P. Q# U
function IsaNull(cCheck) ; q8 y7 s: I9 S+ j+ b% S/ u2 ~
{ 0 m4 ]5 @) y' s- Q; {0 b
return(cCheck != " ") # e6 A) {+ {3 i" u& H) }* b
}
7 ?# N% V( B. r . L1 ]( F* H8 k/ }2 G
function checkform()
- c& ~6 A" u! ~5 Q; o$ {{ 5 V* d4 t& n0 O6 g* a3 y# R
id = document.sform1.id.value; ' J" |$ z B( }- }
if (id == "") 1 |; e( F$ x$ e& j L0 K
{
- S3 O* ]2 Y$ F- D alert("请输入注册名");
9 f* o; |# k9 d: I/ n& t/ j. ^ document.sform1.id.focus(); Z) }2 D0 c& ~- h, | B
return false; 2 Q/ H" S$ |. U2 ?, J' g( |
}
9 f7 T; c& I5 w " ^# p8 U; t) A$ H6 O
for (nIndex=0; nIndex<id.length; nIndex++)
9 W1 t% X9 Y* g1 ]- Y2 P {
/ ]0 I) G+ x6 e0 l cCheck = id.charAt(nIndex); 1 B1 x* n4 I. y- o* c
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) * K# z1 D+ }& ~( d( {/ ~: j4 I3 u e8 ^
{ 1 q& Z5 q* t% B! U0 Z" y$ K
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' H2 q: z0 N' S8 e( } document.sform1.id.focus();
2 F$ ]7 A- h6 i, g. |3 k* J; m return false; 7 O& k8 D5 o% X% V! S+ C
} 1 ~$ y& n% ]5 q& Y; a
} 1 _# v7 ~5 o( A( L" j) j! A, b
chineseid = document.sform1.chineseid.value; / N4 f# g9 ~# m2 `' H% m! t# L4 P
if (chineseid == "")
4 k" b: B+ i+ z {
/ Z. l& }+ d$ ?# x2 B6 Z& A alert("请输入中文昵称");
. O8 S$ {- \" T. G3 P* b1 c$ j document.sform1.chineseid.focus();
' T, s% c0 o4 L& O return false;
# q$ {8 B. l/ G" b }
9 q- k& h N0 a5 w( y% U7 l password = document.sform1.password.value;
* n! A; ^& {! m8 ]$ d if (password == "")
. T& p0 u L7 P5 g0 G- F" s { ( I/ w( C f a$ J" F& B! e( c
alert("请输入登陆密码");
* s$ s0 g* l, D' v' F& ` document.sform1.password.focus(); $ f9 H4 ^+ I: `) G1 W
return false;
1 \0 M6 H, T" s o }
) w/ f: [4 ]& S6 H0 L password1 = document.sform1.password1.value;
5 _ K2 z/ `' t1 Y u& |- ]) i: j$ y if (password>password1) ; d+ p" X9 @0 P# F
{$ o7 R+ Q/ v5 {+ v s
alert("重复密码与登陆密码不相同");
0 H8 I G4 I* ?' h; ~ document.sform1.password.focus(); 2 S C: ^4 ~ H6 \+ X* \
document.sform1.password1.focus();
0 {. I4 [% q0 Y1 y! }4 G @ return false;
7 W! z% L; T3 D7 j" V* e }
- u2 h& M. J1 Y2 ^3 Mif (password<password1)
6 F/ B6 x! c. P4 ]# R* }- q {" a X7 ^; I1 h
alert("重复密码与登陆密码不相同"); 4 J2 t) y/ s, H% L% o
document.sform1.password.focus();
+ R' c1 |- Z5 O3 t; {" R" ? document.sform1.password1.focus();
' Y2 t: k7 p( {+ U. S, { return false;
9 H' w+ }! P0 A C2 m7 H( d }
6 |9 i+ O5 w% _8 G if (document.sform1.email.value == "")
/ K# f1 {$ {1 i' r- c! ^ {
6 Q8 n- y k' c alert("请输入您的E-MAIL地址"); : w' h4 K; i& f& M- N1 h. u2 S
document.sform1.email.focus();
1 ?: c8 I. z0 f/ O) r5 W! f' R return false; 0 a$ T0 m0 [& H+ q8 s
}
/ y7 }% k% h/ \* K7 O ' m! b5 P( m0 k2 @1 k2 ?( I# Z
email=document.sform1.email.value;
" ~, I- M0 ~& {; D1 M: j b! ] emailerr=0
0 o& o' U! V& ~1 Y8 V for (i=0; i<email.length; i++)
( z- y S1 i5 G% N { 6 s: E8 Q7 N% a1 d* U* D& R9 E; r
if ((email.charAt(i) == "@") & (email.length > 5))
, s3 v( j- Y' \$ K1 B' r { ' M! a- d, t4 S8 ~
emailerr=emailerr+1
. i. t, V! W9 I$ G0 F) } }
4 L" `) D* I0 s0 {8 J' N9 N } ' l s# A% b" t3 X' y8 b2 }
if (emailerr != 1)
- ~, `; Q4 e0 S1 ~1 |% x4 p { 4 S! i S& x/ g5 u" d' U" q
alert("请输入正确的E-MAIL地址"); ) {; D' v1 l; @# A2 M. U# N
document.sform1.email.focus();
% k8 h- x8 D' I return false; 1 [1 H# Z% ]/ u3 F- ~) G) S- k, K; Y
} $ z) _5 F$ s! ^5 g; A2 k( ?
( B4 I9 m; O% |( F if (document.sform1.checkask.value=="")
0 @+ p: ]# M0 \! M { 0 M& g7 b3 [* G9 D+ q, d0 _
alert("密码提示问题不能为空"); $ Q; D5 p8 e& Z# }
document.sform1.checkask.focus();
% y2 A0 ~9 u# ~! u3 v7 D8 @: w. Y return false;
# L# B9 y& t/ j8 P& N }
" O% c- S( b- W2 p if (document.sform1.checkans.value=="") - V3 D. m- c, w$ ^, }. \
{
" x+ f; S) S* s/ H. l9 ^* E m alert("您的密码提示问题答案不能为空");
& j1 N# H: K# w- O document.sform1.checkans.focus();
! F; @: I4 R7 D' i; F7 {1 ~ return false; ! ]5 }( k+ G+ F. d1 Z$ [
}
4 z8 `7 ]4 _9 B0 \' ~$ O ]$ R return true;
( m* H- K( l& x3 T , T( \0 l: o, J: t/ H7 b! H8 P. F
} ! a. j4 h% p+ u3 P8 C, b
</script> |
|