  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14163
- 金币
- 2372
- 威望
- 1647
- 贡献
- 1320
|
这个脚本对你可能有帮助:/ e. {' K" ]' ?" E% [
<script language="javascript"> k) f- v/ ^( P5 R0 @: r+ s: T1 ^4 t
function IsDigit(cCheck) % |+ T, U" m7 v* _% |. ]
{
) g S5 p; q2 e; Q return (('0'<=cCheck) && (cCheck<='9')); . I& b5 Q- C. \; P* a
}
; D# X t: y E4 q0 ]7 q9 \ " A5 r9 k# p& L+ r
function IsAlpha(cCheck) + h" G Q& g6 A; i2 P- t$ o
{ ; X9 n9 U* n7 F6 h8 b
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) $ @3 x% m6 L; x
}
, `* u E9 l; ^, G9 x, _% o6 G0 x. Z
) ~5 W; n! h5 @4 c; Tfunction IsaNull(cCheck) $ K7 E. J% `- X, V: w4 `$ Q6 z
{ " }5 [, P4 _2 D5 I, J3 [
return(cCheck != " ")
! B, s, n8 f3 w% k' M& b }
% X9 D# l- J/ ~- F- c' L
|- w7 x1 k; s; f7 Ifunction checkform() 3 Q5 B3 M& y& H2 a$ B# E
{
/ @8 |3 A7 \# ] id = document.sform1.id.value; - ^1 k' i0 c, T- _# c) V' P; [) G
if (id == "")
$ w! K. u! q/ T {
6 q5 r6 W" y) V( }4 J# J5 E$ M alert("请输入注册名"); ) N" p! T+ B! H- t) r M; B
document.sform1.id.focus(); 8 e- l4 h0 k# l0 P5 E8 e4 Z0 ~
return false;
, o; n/ d, y& B1 d8 V& Y }
8 y2 N1 P' _. |0 c" @3 g3 ~! w
1 d2 J* s' l: B. k9 y e6 c; k for (nIndex=0; nIndex<id.length; nIndex++)
% Y# `7 _- ~6 v B' R { 6 c; m$ V+ F! D3 ^1 z
cCheck = id.charAt(nIndex);
j6 ?: S% z) O$ E# W- K if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
9 z9 y8 | r( j! a4 i {
2 x% t$ x2 O) n; u1 Q! { alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
7 ^2 G. ~2 T# r# R1 ]9 P document.sform1.id.focus();
& w9 L( v" l( u. n! M+ h return false; : _- `' U! a! W: c% a
} + ]' d6 j. n3 M- f# g
}
* C9 b1 s0 ^: _) p& j) b% a' ^ chineseid = document.sform1.chineseid.value;
5 v' _* e8 L! o# y5 U6 D1 x& s$ Z1 E1 H if (chineseid == "") : l$ Q2 e8 p6 `! n, W: Z- D: j
{
, \/ ~7 S* A& f4 d" F) Z5 A alert("请输入中文昵称");
7 s8 J7 e& V/ M document.sform1.chineseid.focus(); 0 E2 H7 A) k) O( A
return false; # g/ X( a! J" m6 _9 Y5 b
}
; ~- X4 V5 z7 _+ }3 f password = document.sform1.password.value; $ C/ z1 O3 R) B" H* r
if (password == "")
0 w. R8 L5 ^9 C) L% |% ^2 k+ I { ; v# E: W% m* @
alert("请输入登陆密码");
. N% R- i6 G2 m3 B, z7 U" F document.sform1.password.focus(); " _( B, @' F+ @
return false;
( x1 e- K5 G% ~8 {/ L6 i }
' T% ^, G$ F; t( g4 d# X$ ^3 \$ g password1 = document.sform1.password1.value;
1 @0 W8 ^7 S6 ]( N M$ R/ v if (password>password1) + f/ T2 ~; ]' V5 d& t
{, g& f f$ _. d$ ^/ H
alert("重复密码与登陆密码不相同"); 1 H3 J4 ]$ g$ Q: p8 n7 y' Y
document.sform1.password.focus();
; N( o& u E) i6 V2 A8 O document.sform1.password1.focus();
( P1 ^5 ]: G) d/ a! `- M return false;7 R; T$ E- ^' f! y r1 `
} 2 |2 ^8 R$ V. f6 O0 y
if (password<password1)
9 S) u* a' S0 R/ W {
) N9 }: U3 e& h" G! `- I alert("重复密码与登陆密码不相同"); 4 y3 X, {* x8 f Y) i/ ~
document.sform1.password.focus();
* | ?2 i& h% K9 v6 ~ document.sform1.password1.focus();
" X7 G5 M F$ P6 c% a- Q return false;9 W0 k) B; M3 d; B1 Y
}
1 L0 d& B3 _7 g7 v- i if (document.sform1.email.value == "") $ k5 D% |& f6 O- d
{
( y& M( g- y& Q) ^ alert("请输入您的E-MAIL地址");
. {& N/ W3 O$ e. M. T: k document.sform1.email.focus(); t4 {; H: Q0 o- P- z4 U
return false;
% o! k A: w- t } ) L& `- X6 l! ~ ~2 F% H
2 q! d& s+ a) v1 }8 I email=document.sform1.email.value;
9 D2 p# d7 G% t. @& n3 ~- l( h) T emailerr=0
4 N* ?, W+ y% k for (i=0; i<email.length; i++) / [* E6 f- X1 M# o
{
8 o- [! I( L* V. }1 \! T if ((email.charAt(i) == "@") & (email.length > 5))
4 v* P3 x- G) \) m0 |) L { ( g$ t6 c* }* z, J( @8 |
emailerr=emailerr+1
, s# {4 c" x0 T3 X1 ^ } * N8 {! F: E. ^ }
} ' H- k: b7 L, {# H1 y4 w
if (emailerr != 1)
7 t8 U$ \) N: J- V {
* f2 z, \* k2 A alert("请输入正确的E-MAIL地址");
1 p) x* _: ]( e' F) ` t& z' ~9 ~ document.sform1.email.focus(); ]8 m6 ?2 A7 L# _. c. h2 @* S
return false; + }) }/ k. Y: w, v9 ^7 O' |& D
}
& O1 X% F1 G+ k5 M! ~
) Y+ b. j( m. [. X if (document.sform1.checkask.value=="") ! h7 I6 v- E% Z0 e1 {3 U$ q
{ - b+ o8 \ g/ P6 y" R2 e. J
alert("密码提示问题不能为空");
% }) l+ \* s, w, A% ] document.sform1.checkask.focus(); 2 r. R3 r. l& |7 q' t
return false; # R( ?% U9 _/ P2 E
}
) t4 k8 h0 Z \" n! o8 k5 Q! } if (document.sform1.checkans.value=="") @& S8 J2 E+ n e& U j3 S
{ , N7 y- X' ~2 o/ ~$ T. v. h7 T
alert("您的密码提示问题答案不能为空");
9 L3 G3 x5 Y+ E* T! S1 z document.sform1.checkans.focus();
|: ~6 A4 V, g2 q6 b4 w$ c* ~ return false; 4 D! u$ X' A4 ~9 A6 D2 @
}, k+ E r3 a: N. }
return true;
" K8 u3 v# \3 ]4 D5 u7 X; O. Y) g: m) Y 7 e6 r/ f3 f8 z( q8 j# s# x
}
: c2 I7 l5 x8 f</script> |
|