|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14395
- 金币
- 2483
- 威望
- 1647
- 贡献
- 1431
|
这个脚本对你可能有帮助:
8 U9 f% w$ E/ s9 `% d' [4 [<script language="javascript">
5 B9 v& R, `2 `" nfunction IsDigit(cCheck)
( m/ U+ F u8 ~) G, A4 [# d {
1 ?) O6 G! V8 C. y return (('0'<=cCheck) && (cCheck<='9')); 2 ]7 J% O* G [- x$ D5 i9 v3 ~( ^
}
; e' D; ?0 n2 h2 Y9 E1 {5 W
: M4 k: `; c8 _) D7 Vfunction IsAlpha(cCheck)
( h% a( E0 f) h# T4 l0 ]2 i0 i { 9 v4 ~! j9 x1 w+ X
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 {+ {& U, l( `& i; |, Z' ]( a& b
} 1 n9 r* K0 x% u- _: o0 x
: Z9 R$ L- B! V5 ^! @, g1 Gfunction IsaNull(cCheck)
& k$ N+ f0 M7 C7 ?& z {
, O" ^* G) j. \( } return(cCheck != " ") # y# b }/ @9 G! l0 u. \3 f
}
?' B5 f/ ]0 Q8 d. ?0 A
9 i" r, p. B3 ?$ H) n% }# m" Dfunction checkform() - f( m% Q- y# b3 w& P
{
8 ^8 v8 I. J9 R3 M id = document.sform1.id.value; / U/ A5 L% G! t! n7 Z% P( X% I
if (id == "")
?) F8 y9 M8 O { 1 A7 K2 }$ U$ k. i
alert("请输入注册名"); 4 r& E. o* Z) g8 B1 C
document.sform1.id.focus();
+ f) r* H8 Z' a. k% Z/ C3 { return false; * C* m# Z* n9 A `) S
} " f8 V7 S( _9 ]* x/ q
4 A& \( k: g' a6 w for (nIndex=0; nIndex<id.length; nIndex++)
( a% ]4 |* ]' t. b8 x {
7 j/ y; l- M, M Z2 s cCheck = id.charAt(nIndex); - h, t2 U% U: ^; y1 F3 q7 `
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) " w) F9 G9 ` E6 \
{ * Q, B9 Y! f( q) u( j4 ?1 X
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
( ^2 q' S9 i) h& P document.sform1.id.focus(); 2 L6 U c* p5 r4 K; x
return false; " j6 B9 v b9 ^0 s) w
}
) n" V- H+ B: B1 Q$ g6 y# a }
, C; L6 e5 J3 n( A chineseid = document.sform1.chineseid.value;
/ E/ N+ r# D* p. I/ ^' a' v if (chineseid == "")
6 i* H0 @ S `. o) } { / `% e: c. N ^% C
alert("请输入中文昵称");
7 C8 }) z$ F$ b6 L7 s document.sform1.chineseid.focus();
' U. ?% y L, B" x return false;
" w1 k; q* |& u( @0 R } # ?$ B- ^4 S! { r
password = document.sform1.password.value;
) S9 k9 a- S0 Y. `. n9 j) M' ^1 V: R if (password == "")
( F7 r; U, Z6 C1 v- R { ' s& U4 T9 q3 n
alert("请输入登陆密码"); ) K- t J+ r8 Q
document.sform1.password.focus(); 6 R& V A) u" B
return false; 5 P5 o6 P( a: p- f' }
} & e% o# d! O" `" \4 w
password1 = document.sform1.password1.value; ( R5 h: l, Y! b. C
if (password>password1) 4 q' G- P% d# D+ c! c
{
* l% e6 H& |7 _' E alert("重复密码与登陆密码不相同"); 9 D; K$ C- @9 K1 |( x {/ \2 G
document.sform1.password.focus(); * W! n8 I0 L" h
document.sform1.password1.focus();
9 E. B' d5 c9 W! _# h return false;
" i# C. `' y" a- [5 k* u } 4 E4 v: f: W( |. r: j+ ]; t! Q& _, E! c
if (password<password1)
1 E& y1 Z/ u2 x- f6 |8 D* r6 p {+ m8 d4 I- Q8 V5 S; N2 \. w
alert("重复密码与登陆密码不相同");
# t. ], t T( |; U% B, R document.sform1.password.focus();
* \" \6 s! H6 D3 D; B document.sform1.password1.focus(); ) \, i0 D1 c4 v
return false;) |( ?7 l; X0 Z4 L0 r
}
6 |, g. t; W" u3 l if (document.sform1.email.value == "") . ?2 ]' {; ~$ d! i1 n0 ~
{
4 `2 c) L1 d' r* c alert("请输入您的E-MAIL地址");
( W: i, a# z0 j document.sform1.email.focus();
7 l" V+ O$ j: l# u" z return false;
" v1 t/ Z, ]7 k4 v" q( T } 5 f; ?1 j; @5 E9 u
$ {, W$ Y& Z4 ?) W1 s
email=document.sform1.email.value;
9 z, i) C% Z% W: I/ a emailerr=0 . K, `+ T: P- y; y1 `
for (i=0; i<email.length; i++) 4 h- R: X& [9 W Y0 c4 X7 b/ w3 g
{
% v, F- s4 I/ R1 M- G% R. f- @ if ((email.charAt(i) == "@") & (email.length > 5)) ) N. z: E+ V8 M+ M
{
, [' C' `, D" e( p4 C- H1 n3 q+ K, x7 ] emailerr=emailerr+1
/ y& D( H/ Y5 n5 Y$ E }
- G4 X1 a! e9 `% ]) d v }
$ r; S2 I$ t# ~" R1 i if (emailerr != 1) " V0 G+ B1 x) f. b0 D# Z
{ 1 N$ P8 m! a$ p3 h3 p0 i. k
alert("请输入正确的E-MAIL地址");
* K+ r; q3 @& n: g7 @; S; G document.sform1.email.focus(); 5 l2 Z5 ?1 |! y l {9 b2 C
return false;
7 E3 M# r* F8 F } ) O! d. P7 o5 d
+ l! S& \" l4 O+ j0 X' D0 R! m+ Q* k0 p
if (document.sform1.checkask.value=="")
, a; ^! \2 E2 B {
; B N9 n, r2 M alert("密码提示问题不能为空"); 6 V& @" Q7 W* _8 N/ x& w5 g
document.sform1.checkask.focus(); * `" L" R, q9 ?4 \7 c9 m! k5 I" f, E
return false;
/ g# U8 H/ t+ i+ X! h! } n3 c: [ }
4 Q+ T! E7 N3 [4 M if (document.sform1.checkans.value=="")
; n3 C# Y8 H+ E$ I/ w y {
8 h( a8 ]! [3 t# ]+ U5 T- H/ f1 B alert("您的密码提示问题答案不能为空");
9 U6 W/ L' f9 f* t. g0 p document.sform1.checkans.focus(); 9 I/ A/ [' T) o. j, O# ]
return false;
/ c3 c& j# N" p M) i9 ] }
8 I0 B( E% e. y0 k, E return true;
; x8 D9 r( H$ o a# q ( _& P8 C8 ~5 o; _
} 5 K! U0 C, B, @$ f
</script> |
|