|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14349
- 金币
- 2460
- 威望
- 1647
- 贡献
- 1408
|
这个脚本对你可能有帮助:$ K5 ?5 u6 e7 R& T. r8 b$ }5 n
<script language="javascript">
1 [4 N2 H8 m: ?3 a+ O6 B! ufunction IsDigit(cCheck) & L9 i7 V% E/ ^
{
" Y7 p+ w+ o; ] return (('0'<=cCheck) && (cCheck<='9')); & Q2 w P& v A8 s0 o% a2 n1 ^
}
# ^1 y& a) }( R C+ I" j, @ \
/ N7 X6 k6 S- P: i! E, J( T& H( Ufunction IsAlpha(cCheck)
! B/ l9 Y$ {- w4 N { # m7 q/ R# l: \6 x
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
b- r& w+ ]$ i } / U' ?- B( {, q) O
8 N( ]% S5 }: K3 G/ _& N
function IsaNull(cCheck) - r. Y, ]& h' s/ v
{ 4 V! Q4 d5 Q, W! X3 N1 B
return(cCheck != " ") % K. ~3 T) d3 |
}
9 y; t( x; V% Z6 ^3 a 1 h ~* [; V" H5 | V
function checkform() $ c/ P" q; l( I- d( a
{ 1 ~( y/ ~# h) E2 g1 g
id = document.sform1.id.value; ' D; I- S5 p: ]0 |3 M, I
if (id == "") - e; N9 L# q$ [
{ $ ? T) ~! v, Q. J" @
alert("请输入注册名"); , {6 X# @5 r; I$ g/ |2 X2 M$ e
document.sform1.id.focus(); . P7 i! ]+ F; O
return false; % V m& ]% T7 d! D/ { T
} ) [: _9 T. i) i+ a# d& n( n5 D
, n& Q' e! O: {0 \0 {3 y) S! O7 ] for (nIndex=0; nIndex<id.length; nIndex++)
$ f8 u" O, T, v" I Y D1 C { . H0 L" q8 Q; V2 Z
cCheck = id.charAt(nIndex); " i1 Y2 Q1 H+ M2 T1 n
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
( O; _; ?+ P! H& t {
' V8 h! m3 e* c% |2 L alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ! `: w9 o! h4 Y ~* k S2 y
document.sform1.id.focus();
* _& r# h, k! N return false;
E$ p+ L0 Z& e2 J/ D } ( h, `4 P7 O1 f8 M$ o! w
}
' Y) N: V/ x- _' A' e) V1 z+ v4 J chineseid = document.sform1.chineseid.value; 8 Z1 V! H' C9 w2 C, t
if (chineseid == "") # k1 e# v( {" S) d1 ~7 O
{
$ _! U4 ^2 W" i! `; R T+ h, y alert("请输入中文昵称");
_# u" H, E4 m& _ document.sform1.chineseid.focus(); 6 h9 P' i. f2 U- r) k; R
return false;
. [& t2 i5 q! _ } 9 `& Q2 n9 Q r6 X
password = document.sform1.password.value;
( }+ C) ~+ R' S! r if (password == "") * N$ T* G1 \+ B* _. {8 J1 o0 n
{
' Q1 U6 H4 q$ M) w6 ]( { alert("请输入登陆密码");
" t% B" f4 O& e document.sform1.password.focus(); + @5 d2 y: W% s8 ~
return false;
, j! ~; `$ m9 K( |' K } - \+ }% v9 d# y) M: @" v: K' M
password1 = document.sform1.password1.value; ( Q3 b3 ~- K( o k( x5 {
if (password>password1) ; `: d1 C v6 u! M) L& n1 \
{; s( H- l2 u" O$ _& @
alert("重复密码与登陆密码不相同"); ; i6 M8 h- `2 H; N! ~) O% P
document.sform1.password.focus();
- g. S$ l9 D- K. I$ \: \8 M document.sform1.password1.focus(); 5 f- c& [- I- k/ e% b+ n2 P% l
return false;
7 ^; x8 C. J3 S+ L1 M+ E2 \) _( u U }
- k8 V; n# B" Bif (password<password1) $ i3 o3 ~. K9 o" s; F2 `8 x
{
0 c2 q; u' J) ^6 S, v* o alert("重复密码与登陆密码不相同");
4 p6 [6 _5 A: c, C Z document.sform1.password.focus(); # a( A1 A c8 m6 L8 U6 q7 g
document.sform1.password1.focus(); & P9 v0 G( a) Z# X0 ]6 V9 h" D
return false;3 S- ~7 k. r2 f
} 9 g3 G, R2 }+ R# L: x" j
if (document.sform1.email.value == "") 9 d2 x' j" o. \4 `/ X) ]" `
{ & b* Q9 q7 w4 p5 E3 V
alert("请输入您的E-MAIL地址");
# S F& z9 S' f document.sform1.email.focus(); , _3 X* ]) c. C. { o5 t
return false; - D9 ]/ q6 l8 @% ^/ N" q4 P
}
8 l/ I0 v3 m8 N1 l: N+ D: E4 H
( C9 l2 p7 ?$ S email=document.sform1.email.value;
" k+ G2 _- ~! Z6 z" f emailerr=0
4 q9 F5 {2 e8 r4 T0 X for (i=0; i<email.length; i++)
0 g: z3 |" u3 Y$ j1 C W { ) ?2 x/ f$ |- M. B# c
if ((email.charAt(i) == "@") & (email.length > 5)) - `7 S$ _ V1 B
{ 1 \ [* x; @9 u/ D& w8 ~* q R3 E
emailerr=emailerr+1
* I# y3 w6 n; Q2 [2 p } y# k( r3 x p3 R
}
8 o4 u9 L: _ p( ^1 `6 R' W if (emailerr != 1)
, V8 K! |: R4 N, I& x& [5 U1 ` {
) n* T# c) [6 K8 E alert("请输入正确的E-MAIL地址"); 1 k3 U* S& C; b7 v* `
document.sform1.email.focus(); c5 l! b0 \8 h, ~" h% n
return false;
0 i; S& p( G) Z }
- Y/ ?7 k7 L# w1 ~0 t$ v
0 s8 N( ?) @: s* W8 C if (document.sform1.checkask.value=="") * D( x. ^+ ?) c( z7 {1 G2 c: V7 x
{
3 D1 ~- {3 ~3 O7 b) m+ d; V alert("密码提示问题不能为空"); ; O1 I# P s, @+ F! b. _5 E
document.sform1.checkask.focus(); , C" r3 B4 K; g
return false;
" S* l0 Z, { _" R2 \ } & |; D( h- |( x" U( O) Z# Q
if (document.sform1.checkans.value=="") / W& U: |- F8 o% p w
{
; P& P. h/ z8 w' |& l- \ alert("您的密码提示问题答案不能为空"); & ]: O9 ~" a5 D2 f+ g5 L7 F+ D
document.sform1.checkans.focus();
@/ L6 [2 G* Q4 ]9 G: e return false; ; n) T/ n9 l( w& a$ O/ l
}
' V6 J8 w+ j: g3 N3 L return true; + j6 N) ~; d2 n2 @
8 Y9 {% N- `# k1 \3 r} 2 S( c1 p( Z( @- |4 J% c- T
</script> |
|