|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14365
- 金币
- 2468
- 威望
- 1647
- 贡献
- 1416
|
这个脚本对你可能有帮助:$ ~" z1 U6 w$ ~. n: {8 u
<script language="javascript">
- _1 M7 O- G* A( Y' }& @function IsDigit(cCheck) : v. t T$ D0 }9 G3 o
{
, w) ?" b2 {0 u5 g0 h return (('0'<=cCheck) && (cCheck<='9')); : H5 U* z: K$ g( H. E0 l/ z5 @2 F
}
6 t1 p, @% P) L7 P
/ P4 X& W1 b, c* a4 v7 Q( wfunction IsAlpha(cCheck)
) e1 T: F8 e; {5 K* q9 q1 r { - ]4 z& U* y, F2 E9 ~
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
, b6 r# S' m# b) X }
4 M' _1 w8 a, Z3 @( G 9 f, m8 |/ {1 x, Z# E5 ~* E% A- w
function IsaNull(cCheck) : c+ U0 T, L Y8 z' m
{
- C" c; E7 `# g9 I% ? return(cCheck != " ")
6 v e7 \; }. G/ [& e }
3 A, \( h. A! A6 x6 I/ c
9 O2 f$ T' D) S# `, dfunction checkform()
! a. H' S' K1 K+ X: ~5 a: d{ 8 z1 Y( h8 X' t! }2 }
id = document.sform1.id.value; * y+ }5 y5 _/ U7 u+ J4 J
if (id == "") 6 [& {- g, K2 E8 x4 k$ o1 y
{
+ ]8 n, N9 Z( g- W) S% J3 Z2 y# Q alert("请输入注册名");
3 T4 Q- E$ Z* e& f document.sform1.id.focus();
# H' m) I8 E' a4 F: O2 r7 k+ M* u return false;
- U) R5 l. {0 D* Z. |/ A% \# F! y } 9 N$ w( Z/ K: E# B! G+ G
6 c* L; B) n6 D
for (nIndex=0; nIndex<id.length; nIndex++)
2 |5 D0 r) O% ]" j ~. Z { - `6 |7 g0 M2 y+ A
cCheck = id.charAt(nIndex); * x; w7 D5 U* l* A) A1 Q2 w
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 l7 ~+ m- Q, d) r& y/ m( p { + T- M. S! g. T: `3 o; j
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); % C" l/ G) w. c3 o
document.sform1.id.focus(); 2 I% f d$ }4 g* ?( H, M5 d) u
return false; / k& k/ U/ ]* D5 f# N7 P
}
2 e! E+ o, g) d6 ?" i$ G } 1 x. R" j$ U' Y8 i9 y
chineseid = document.sform1.chineseid.value; # R$ E, Z2 B: T# v |# `( w
if (chineseid == "")
. F0 _5 l! g) g { 6 p/ T8 M, j2 i" g. G4 [
alert("请输入中文昵称"); 4 r' f; p% K4 G Y- r ~ k
document.sform1.chineseid.focus(); $ m. g) D/ B; ~+ f F# z+ s
return false;
1 m" w7 o1 z' x% k1 s n } * }+ w( w2 y, y) L0 R
password = document.sform1.password.value; ; L0 h8 R: q0 ~( H7 V t
if (password == "")
) K% \ J' h7 d! k* p) y { * h0 I3 ?1 c8 U. i
alert("请输入登陆密码"); ) n3 V! F) B% x9 V
document.sform1.password.focus(); 8 c' ^1 f# s1 i) _& z G* B4 m
return false; . ~, N; ]& u+ r
}
1 K, E2 b0 m G password1 = document.sform1.password1.value; , @ k1 ` {. w
if (password>password1) 3 k( V2 N# n6 q, y6 j' A/ t
{
; E9 q- w' E$ }0 I# ]% F, B! S alert("重复密码与登陆密码不相同");
& V# C3 T( y5 N6 E$ X9 E* i+ ~* e document.sform1.password.focus();
" o6 H& Y" H% i6 @% i document.sform1.password1.focus();
2 [1 P/ E6 d2 W return false;
8 [5 c; @6 u8 ~1 q! [ }
" d- \" ?' L* ~9 N7 B( Gif (password<password1) 1 z% u9 ?( I: }/ }
{
( y1 @* r2 k' a" t& j alert("重复密码与登陆密码不相同"); 7 x" \2 k0 ~5 N/ D* ^
document.sform1.password.focus();
# l: G/ I/ [4 r document.sform1.password1.focus();
# X+ M: m/ ?' {% h, Q return false;( j- U" ^- m. e
}
' K6 t) E) J# [/ ` if (document.sform1.email.value == "") ! H' P7 M' @8 y9 ?
{ / S% H1 ~9 r _% }6 m
alert("请输入您的E-MAIL地址");
, l. q1 |6 H; M; p" s& S, g4 M. { document.sform1.email.focus(); 2 x0 V; P8 X( ^3 K: z1 p* E
return false; 3 u/ N" c9 o) g) J7 ~
}
. ~# p* q5 [% K
; m# D( P% @( [) z! T3 u email=document.sform1.email.value; 4 U/ P$ b6 e; Q/ h& E
emailerr=0
1 e8 [3 n0 L1 n( s for (i=0; i<email.length; i++) + j! _3 s, Y2 [' t& H
{
) b5 ]5 ~+ B) B( G( S if ((email.charAt(i) == "@") & (email.length > 5))
& h+ m, y' J/ c/ c. j v5 K! t {
3 I6 ]7 D4 B8 M9 K' @ emailerr=emailerr+1
! ~* F4 N: I9 j P; C0 l } 3 }8 e# Z" k' c) P: F5 Y( f
}
. ?8 ^' C4 b5 t4 ^. {* q if (emailerr != 1) ' ?& d7 F" K/ ?
{
! l$ e4 h, h6 ^( m" F alert("请输入正确的E-MAIL地址");
3 W% }+ a7 W$ C& _8 f* z5 [( } document.sform1.email.focus();
1 u: \0 C/ z9 ^0 z3 }/ { return false;
+ {3 i6 t( x y9 T6 t3 _6 o5 G }
5 a" a% u+ X6 B 3 {+ N" [* p9 }/ s/ H- f. }
if (document.sform1.checkask.value=="") & I0 M, p% _% y& T) z4 k
{ , m% K5 i$ W; n1 k; e
alert("密码提示问题不能为空"); 5 t5 W0 y0 o5 |( Q
document.sform1.checkask.focus(); 5 M/ i' O$ H+ h) a
return false; 1 I3 K+ R7 e7 y7 f- g/ B' e' ]2 z
}
- p3 L8 C) B7 U* b# Y4 I if (document.sform1.checkans.value=="")
4 G A4 \( u- s) ?- E Q! B { 9 Z# |, ^. |* P; E' _+ l: P1 J8 U
alert("您的密码提示问题答案不能为空"); 0 E7 b, M w( l* x7 l" S
document.sform1.checkans.focus(); 8 f O4 t) \3 C$ L- Y E$ \
return false; t; o$ E* ~" F5 b, P3 y
}
& S; j7 w& J$ q return true; . {' R+ x3 O# m, V' a
+ F+ K9 _4 D4 }
}
. i+ Y" g/ {/ o* T</script> |
|