|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:
% `" z! l3 p! P# R# k; ?4 X<script language="javascript"> 1 V7 d4 Y" d; v$ R" J
function IsDigit(cCheck) # |# e( q7 f% V
{
: a6 y) [5 a9 |- E N/ L) i6 Q return (('0'<=cCheck) && (cCheck<='9')); 2 s7 G! Z) Q5 p/ n) t( n" z6 ^
}
2 {, c+ c/ \0 L2 A* y
& l1 q# Q) k+ Ffunction IsAlpha(cCheck) 2 @! a; w' I3 i) d
{
|7 \$ A' L" [' x+ X8 C% Z return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
6 q% W- I6 ^! C! n } / Z. u- R, ]7 o& u
8 S( c" t: s3 m: G" Z# `
function IsaNull(cCheck) + \3 q7 H# S! K
{
4 y* s0 B. |: R# c; ~' g+ n7 q5 I return(cCheck != " ")
( r: z, T, F) B$ y" M }
4 R* b" m2 e+ S7 @7 c/ V + n$ ]+ e1 F; l: j9 @: {; f7 }
function checkform() " [; ^ N- p' S4 h; C
{ 3 u l8 A: t" k3 I
id = document.sform1.id.value;
8 Q$ H6 K0 }7 j- l( M! I$ P if (id == "")
0 B: ?) I! m6 W/ l U' `+ o2 i { 8 j `3 R/ R c" M" J% L' R) s. E8 B
alert("请输入注册名");
9 _9 U( M( T1 \$ s7 ?( i document.sform1.id.focus(); 6 w) |1 r7 m* V: f$ U4 E: T
return false; 5 O. x4 W. x: `5 n" X q L5 f
} ( L9 ~ E1 h9 }# L$ M" x) Q
9 P4 z$ d4 Z$ Z# q! t- P for (nIndex=0; nIndex<id.length; nIndex++)
% `) T& C6 p z% I3 n* p3 S4 k { x% e8 ]# @% E
cCheck = id.charAt(nIndex);
: k( l* M) S1 I N if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ; {# ?0 A |( F$ X; w/ V
{
3 U: D3 ~9 s; }( m alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
" `; Q% t h* n: V2 ^+ m' K document.sform1.id.focus(); ) b$ m% C y7 U; ]2 A$ M3 h
return false;
- P+ t8 u `* k } , W; t0 a) t7 e/ w
}
~" O6 d) |9 {% Z- b0 T+ V chineseid = document.sform1.chineseid.value;
; z* c7 h7 N8 x* \+ A0 S if (chineseid == "")
. f- Y/ y4 i( b e! B5 ^ { 7 H6 H* W" c4 A& h+ s8 h
alert("请输入中文昵称"); ^* x( j8 G; x( Q6 ~* r$ g" l& j
document.sform1.chineseid.focus(); % d% @% G9 J3 R' w5 {5 p7 t9 @+ k) S
return false; & f5 [/ T8 r, S
} 0 e' a; }$ N0 O% g# B# V9 c
password = document.sform1.password.value;
8 R* \7 y3 @& M& \5 M/ k if (password == "") 9 u5 N# D8 C: z1 {+ A) E
{
- P8 M5 q# v' U/ y& f8 b2 \! j1 l alert("请输入登陆密码");
, ]* b1 l( P/ ]% Z2 `; |. L0 M document.sform1.password.focus(); ) P7 k% Y0 n+ P4 f) F A
return false;
5 ]' o. T- Y Z5 g1 m } 3 Y- W' S& B4 t# G: S
password1 = document.sform1.password1.value; 2 H0 K. w# ?6 a- a( C$ R) l
if (password>password1) , i$ _% {# ~' `6 m* L. c
{
4 z+ l( ~2 V6 M alert("重复密码与登陆密码不相同"); ( S# a# K. ?" w, t. A. P
document.sform1.password.focus();
. k& s$ J+ e6 S& N' r document.sform1.password1.focus();
4 w, K4 F( [2 @- Z1 G U, K# A% r return false;
. h3 e4 J5 c0 |3 {/ t, u$ n+ V1 A4 { }
9 W; ~6 N; V& uif (password<password1)
+ M: N+ n3 ^$ ^" x# f {
" f+ L* Q+ Y' Z3 A; C! ~ alert("重复密码与登陆密码不相同"); * d; r/ \( L1 B5 J+ a- ?; i9 D6 o7 e
document.sform1.password.focus(); $ ^( O6 K+ f: |# @: Q, v; `
document.sform1.password1.focus();
, j: P# X8 \) Z+ H return false;
! [' \( j W8 O" p# K } 5 B1 p# q$ C% X- ]
if (document.sform1.email.value == "")
/ }! f* x' \' w0 a0 w! D j- n { / Y# u% S1 H+ E9 t5 x7 f$ W' i) m* b
alert("请输入您的E-MAIL地址"); ! A% p1 S# S6 o8 G
document.sform1.email.focus();
8 {) U8 q9 j/ a6 e7 x+ b+ B% } return false;
3 A, q0 K3 V0 r Z1 g' ^9 a& ^7 l# f } ' a! I" y8 `; d' w6 D4 |0 G; D
" m: w0 Y1 }9 ]7 ~, g0 N, I
email=document.sform1.email.value;
! Y5 Z/ b9 [. v4 x( j emailerr=0
' @9 q! A0 O& w$ ] O for (i=0; i<email.length; i++) % |3 f1 a/ I: v" U
{ , U; X [( G. D& }6 z4 `
if ((email.charAt(i) == "@") & (email.length > 5))
9 [9 ^* i4 i: B3 P {
: ~8 o2 Y/ x( z0 B emailerr=emailerr+1 8 L% P7 ]! x) q% s
} 0 W- I3 i" u2 }; Z/ ~6 B
} 7 R# [! z6 t! L0 c
if (emailerr != 1) ( \: u$ _7 q1 `
{ # u3 N- H2 ~; v3 f
alert("请输入正确的E-MAIL地址");
. B* g- |6 y+ f. d* Q( O document.sform1.email.focus(); s1 p9 m# z: _# X3 T
return false; 7 m( Y+ w& L g8 _! V7 ], l
}
3 J/ k) W+ F5 x1 ?( `' t ) W: y6 _, g( [, s' V9 e
if (document.sform1.checkask.value=="") 7 f/ u7 u" t: U' w$ r
{
% Y4 W' r3 |. k- d, L alert("密码提示问题不能为空");
- }% s' e }$ S document.sform1.checkask.focus(); ( `0 @' r2 f& o$ M
return false;
' H- R0 M# ~% u. J t6 e }
5 J5 z1 y4 L8 L( X if (document.sform1.checkans.value=="") 7 i. Q8 C. C, f! k
{
" Q8 j1 k) b2 C! _- ~! k4 k alert("您的密码提示问题答案不能为空");
1 ?' V4 W3 `* s5 ]3 q document.sform1.checkans.focus(); ( U: D. Q- I! p6 C% l3 m
return false; - e5 _% ~, a1 ~ z
}8 s8 N& ?: D, g5 M$ k; M0 T
return true; 3 I. P: N+ M* U
( A4 F& ]& }, Q n9 n7 g
}
4 s+ C: L& E" b3 T7 X</script> |
|