|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:9 x/ `3 {) V) J. Q ?, ~+ ~
<script language="javascript"> / s0 z0 Q9 W* X2 F1 l$ L- W3 I! l
function IsDigit(cCheck) & j5 b( g9 w$ n+ \8 {& {
{ & [; R: c6 O& V. M& X7 _4 J
return (('0'<=cCheck) && (cCheck<='9')); U; r& v' D6 O: c" S1 e" l+ P$ J
} . W1 `* w# c( N+ ]8 X/ ~6 }
! ^# u0 ]. J' \
function IsAlpha(cCheck)
1 Y7 V! K) M& v# K* p2 n( w7 R { , w+ ]3 s9 ~4 c* }8 w4 }
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
: f- j0 y6 L+ H } / t7 t! {2 T9 b* k1 _' j0 T" d5 E j
! W+ `! V6 s) `. s6 ifunction IsaNull(cCheck) / I, l) F/ E6 ~+ ]$ Q% R# R
{
7 y( A; t( {* W: G8 w. g return(cCheck != " ")
+ s! |: S' \1 U, @5 i8 b } & m6 C# ]! c9 U; x2 t
, l1 Y2 G' S; z$ X" t! S: Z
function checkform() / M& c% c6 u" r, Q2 C* K8 k* F
{
8 d' {5 F1 H/ i" ?/ l id = document.sform1.id.value;
: d' h' B3 P A, t) D0 J O7 ?1 W if (id == "")
0 X' y7 p$ X; O" c { " v: d* k8 O) U* v, d. f3 t. b9 G
alert("请输入注册名");
0 i& d$ q M7 y* M b- x* _" J2 Y document.sform1.id.focus();
. D! M2 _" z2 q return false;
# o. l. F1 s* p! E$ g } / q2 g/ P6 }: z/ W: H4 I4 [- q! b
8 o2 k/ }% }0 e5 {9 A, ?4 G& A
for (nIndex=0; nIndex<id.length; nIndex++) . h& E4 \' d7 w, i; t1 m8 H
{
9 ?! A- y% O6 i* j% r9 p3 x1 B cCheck = id.charAt(nIndex); ' E5 Q6 s/ O/ \3 n4 h/ v! G
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ; E& w9 J! J3 B
{
/ \0 v1 M% l4 E: c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
- Q0 x5 ^/ u" E5 N: x document.sform1.id.focus(); 1 q6 k, Y( [( ]. l/ G' `
return false; - H, D( O% u+ |- m5 B2 E, K
} 8 }: _% o, \+ z; Z. K. N9 }0 e
}
5 g' D3 C6 f2 u( h# Q chineseid = document.sform1.chineseid.value;
# A5 n( t6 t/ M2 s/ m if (chineseid == "")
5 {5 D+ D8 f! G' d! ?- E6 _ { 8 c. u' N. Z% L& L6 i, l
alert("请输入中文昵称"); R8 ^- ?, Y5 `4 G% f$ W: c. ]
document.sform1.chineseid.focus();
) @1 |, K5 c' ~. j2 Y! ^$ F return false;
7 u1 S9 w: _7 G: Z } / a6 x6 E" s9 m
password = document.sform1.password.value;
A; t _- [$ M, [- Z& p$ N if (password == "") + s* Z! U" [% r/ f& b
{
, I8 X: q7 c& B7 l% | alert("请输入登陆密码");
/ J# i1 z$ z1 J- r, l- D) L document.sform1.password.focus();
5 ]4 s1 D1 ^) ?6 N0 | c$ G return false; - f2 t/ [( D2 c0 ]) n
}
. ?+ Z. E# Q# v( _! u% u. |) ~* ` password1 = document.sform1.password1.value;
: v8 F! b/ o7 B2 `( A8 ?% \ if (password>password1)
! s" W- x, B8 r4 A& D {
1 t0 J" J) t" b" a2 S alert("重复密码与登陆密码不相同"); 2 Y( l0 t" c" q+ f% s- l
document.sform1.password.focus();
2 ~: P- U* V* G2 @# J7 W document.sform1.password1.focus(); Y7 z9 O# p' O7 ` C9 {. L
return false;
: g8 u. p4 w4 N7 N1 b' e. k& o }
1 x; p4 J1 ]: Y' {0 a( _if (password<password1)
- I. r2 d d. ^ {
4 ]( j8 N6 z. P. P+ o5 j alert("重复密码与登陆密码不相同"); ' L- V0 d+ C# ?1 ~9 A
document.sform1.password.focus(); # q" M0 Q4 y* e
document.sform1.password1.focus(); 0 A' I+ M: w7 R) B$ Z- v3 `1 j! G
return false;* s6 u6 w& A5 m7 b
} ) M! I# {- l; A. L) v* ^! S
if (document.sform1.email.value == "") # D: F5 h9 d0 M8 [! e
{
: p' F# g% x- e; q7 E, s7 ?/ T alert("请输入您的E-MAIL地址"); " h4 z' S( J* s4 f& ^0 v; }3 S
document.sform1.email.focus(); " v* }1 E6 C1 p9 v& f, l
return false; 8 ?' f* x: S! l8 h V9 m% t- Y* L
}
. u# M( d! z. [$ D4 K & W2 G: f/ l4 x8 c' u2 a
email=document.sform1.email.value; ! `/ `: Y! z- |0 Q, X% k
emailerr=0
. y- ]/ r. {+ N) J7 r' @ for (i=0; i<email.length; i++)
2 ^) H4 l" |' Z; t+ t6 J7 n9 j {
0 g2 y7 Y6 z, j. @ if ((email.charAt(i) == "@") & (email.length > 5)) / {2 \* N' s# a7 ]
{
! G+ h4 w; Q8 d( L emailerr=emailerr+1 " F; q" {1 u4 _& b) ~
}
3 N- t! {* b, k6 s } , I" X) F- i: K5 E( A6 ~4 E9 ^
if (emailerr != 1)
: `' k/ j( t0 b; t: h# a3 y% j, A {
6 R* q p% V( o+ v; b alert("请输入正确的E-MAIL地址");
) L9 @3 I. v! g; x. v# y& `: y, X+ U- o document.sform1.email.focus();
( l1 u# q, @4 c5 N) \7 c/ |! K' l return false;
8 m' U3 X; v4 s q: L8 b) {' D- X- s }
' S/ H2 E9 s: b( P% O; Q! _. B
; `( A, w- Y; I! |$ p if (document.sform1.checkask.value=="")
1 a( [# W7 \* T; c$ w7 C5 a { ! G( ]. U8 D1 s( y7 [3 U
alert("密码提示问题不能为空"); $ X1 B: U) \ V. e9 U. G
document.sform1.checkask.focus();
! I" ` s& r+ P. Y# D return false; 5 l4 y# M$ @3 s2 e
}
: d" Q t; t G) C! j if (document.sform1.checkans.value=="") 7 ^) W1 K z9 l7 A" A6 d
{ ) S$ G' n( O# U" ^8 y" e
alert("您的密码提示问题答案不能为空");
$ V& B. V; C! o- _8 N3 C document.sform1.checkans.focus(); / K3 b3 W1 p. y' ~9 G" K
return false;
2 c$ J% U- l; g2 j/ v' i! i. Q }& k# J! x5 f! X+ Y6 v
return true;
$ y9 z V* b; j q& E
4 M2 I6 B W2 o} 0 w$ }0 A* x6 I
</script> |
|