|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14339
- 金币
- 2455
- 威望
- 1647
- 贡献
- 1403
|
这个脚本对你可能有帮助:, q( h* ]- _; q, _3 v7 }
<script language="javascript">
" b& ] n6 d" b% [( h* m) ufunction IsDigit(cCheck)
" ]; Z0 H* ~# {4 e' x) x7 V { . o7 F6 U) Z- h6 W3 w
return (('0'<=cCheck) && (cCheck<='9')); 3 P8 r: h! x; u9 U7 ~
} + G, ` D3 I6 @/ L5 Q4 N
[; L; {3 K: ]* F8 c6 a3 m
function IsAlpha(cCheck) 3 _5 B, }& n2 W$ a8 t
{ ! }0 Q' z$ E# w% q
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 7 `/ |. S# `) Q" v
} 9 }: S3 Q3 _1 @/ N) d5 }. K
# x, U! F8 n6 a0 [. l T& Z
function IsaNull(cCheck)
$ P# m# v) }4 o5 M. r; Z; t { 3 Z* L, l6 e" _# O' e
return(cCheck != " ")
5 R+ r% M5 f, g- u; R6 U }
+ C( j" W4 @5 y1 x' q( T3 T
, K/ u" X- r+ L0 S+ w" v8 z/ h: f0 g* yfunction checkform()
* t& n5 |; z; P8 l- ]$ V{ % n# x2 z, u, P! s3 ?/ _4 [
id = document.sform1.id.value;
) O: K/ M7 V+ O: U- K+ W5 D, O if (id == "") 6 F* O, \& L% J9 |
{
; H2 O9 H4 _ [1 V+ \" ? alert("请输入注册名"); ! C* c" d" n& n& Z
document.sform1.id.focus();
& a$ y# b+ h- E2 h8 M# u return false; 2 l9 v; l( V# P
}
5 C& [. a& R* f. K |
]9 Y" a/ L% m, S# h' W- A for (nIndex=0; nIndex<id.length; nIndex++)
( @4 @( E5 k, j+ k { * k$ b: B, \. X5 F, Q
cCheck = id.charAt(nIndex);
6 q2 f; j6 ]! [! j5 \- M6 z/ c if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% c7 L& d, E( V/ ~$ { { 8 c9 ~5 V( _1 ^2 u
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
& n5 j2 \/ \1 T document.sform1.id.focus();
F2 U1 `* f" i8 \" H1 k6 g return false;
6 f+ {/ V3 Z" n) @ }
' ?% E) ^( }: o7 U }
, O5 c* l8 n$ U' L) S" @0 _7 w8 S chineseid = document.sform1.chineseid.value;
; B8 S- B3 J4 ]( W if (chineseid == "")
5 X# h4 B1 b! T+ v$ I { & b: L p# F" g& H9 p5 V
alert("请输入中文昵称"); % `$ n0 Y) \8 W8 s
document.sform1.chineseid.focus();
! R5 ?& @+ `* ~; L9 D; B0 O return false;
/ m. P5 o. p/ C } 2 o' l' [+ [ L6 S u1 w9 d& _+ ^
password = document.sform1.password.value;
! U! f8 x; h6 D if (password == "") . v6 Y& P, s6 |* D4 E# j d
{
1 ?; g4 q' n; R$ }7 h alert("请输入登陆密码");
5 K4 t- {) r+ N6 x8 R4 \ document.sform1.password.focus(); u2 ~) L+ h1 \: @8 n G
return false; 5 D) e: \! B G' K! x5 E4 Q( x, q
}
& K+ _! d. I e) a* y D1 _& Z8 J* k password1 = document.sform1.password1.value;
I6 c1 ^5 X1 |. v( B* d if (password>password1) 3 F- h/ Y, A% T3 |; I. u6 }3 t7 Y
{. t9 G3 G. @7 x. M
alert("重复密码与登陆密码不相同");
8 w1 O+ ~+ O; ^2 a document.sform1.password.focus(); ! p3 l& O( B; I5 ^, X+ W, @- o
document.sform1.password1.focus(); 8 U5 Q0 _) ^9 ~, S# o; g& p- w
return false;
5 C( ]* i/ g( }1 t) w8 a$ u. D }
; p) k3 S' n9 I+ `5 c7 f0 Uif (password<password1)
/ P" q- @: v) C+ ~ {0 } K7 k/ i8 r# n) v
alert("重复密码与登陆密码不相同"); ' K: ^8 ?; N; @7 r9 e$ E3 O1 c
document.sform1.password.focus();
: Z) y6 p5 l( {; u0 N) C: Y2 W document.sform1.password1.focus();
/ d+ I; |8 ^& p8 w! x return false;& w& W! }% p H1 g3 C3 }9 p
} 1 i7 @" k5 _, v: p/ `9 P4 n: I2 N
if (document.sform1.email.value == "")
0 t u7 W4 N+ c- T8 S9 S9 A2 S {
! j/ ], Z" H: i- `6 ^( o: U alert("请输入您的E-MAIL地址"); 7 u2 ]* n- Y9 @; B( W8 S
document.sform1.email.focus(); % b, y9 q* P5 G$ |# ~+ w* F+ S
return false; 9 \, F8 n n; p7 m) I
} . q; [6 H8 Q) O* _1 J- y
! P D D# }0 m# i1 U email=document.sform1.email.value;
+ N+ g3 s' ~+ b2 q' z3 V emailerr=0
9 B3 e3 g" ?' G/ H4 u for (i=0; i<email.length; i++) " Y- y( N6 R! ?- T9 y! A" j
{ . n: F/ T: Z; R. p5 _
if ((email.charAt(i) == "@") & (email.length > 5))
. z5 v( ~4 @! v- g% r; G { . o6 x3 _$ h" G% |9 Z9 L
emailerr=emailerr+1 $ q" T, o- _4 Q$ {- z
} $ g5 n' B0 p2 I# S6 K( C# W
}
4 ?" x! l& q5 _, F$ h if (emailerr != 1)
) r2 B; ^$ p3 g { . f M" t' Z! N3 Q7 a& H/ s% [
alert("请输入正确的E-MAIL地址"); # F( N% i {7 e$ p
document.sform1.email.focus();
7 C# l& h' H7 j return false;
' G! o/ Z `9 t7 i } * z3 N% i+ M! H" M3 `* j* x4 b
) E R7 B8 L' `3 R. q4 Z8 M9 P* h if (document.sform1.checkask.value=="") 6 v$ n+ d8 f2 r" I0 s* n
{
' _$ H! }9 W" S; h alert("密码提示问题不能为空"); + V6 n) j, W( G: z8 u. E, C d
document.sform1.checkask.focus();
9 n0 r& U) U0 o; c2 V, N return false; - y1 `1 C4 S ^& o& Z' t1 l3 A
}
) x* d9 k( x1 f0 \( Z, X) B if (document.sform1.checkans.value=="")
' M: \2 y4 F& d& x1 |% E0 o {
# z3 b. g1 u3 p) D9 e alert("您的密码提示问题答案不能为空");
! i1 p$ V, ], s) E( s+ C) n document.sform1.checkans.focus();
4 E6 D& H8 e8 a8 b+ N return false;
" k2 t( X' Q' q* j" p/ a1 e8 X% y }
! O' d& |( w# { return true;
9 j# V+ f8 j' N% I& d 9 ?; T* t; D( z2 H! o+ m- `
} 3 H9 S9 M) K% m0 Z
</script> |
|