|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14395
- 金币
- 2483
- 威望
- 1647
- 贡献
- 1431
|
这个脚本对你可能有帮助:
) E6 `, |; V ~$ @' X( f" H<script language="javascript">
( m5 ~8 t# }% S+ \& tfunction IsDigit(cCheck) . N+ @3 v5 J' L) ]8 x, F; `
{ 7 @) R+ B" U; G7 W. U
return (('0'<=cCheck) && (cCheck<='9')); - L3 x6 Y6 u7 d" _& Y
} % N' X/ P, O0 l( K+ ~4 T
7 @5 c; y2 ~, L c) `. ffunction IsAlpha(cCheck)
' {% K+ K# U: d9 }6 b1 G {
9 }/ |6 i& b6 A1 H return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
2 I& S, [) s: e8 u }
6 x" s2 L; E+ g5 [0 l
. t, c' C& z1 |/ F2 ] c7 O/ ~2 hfunction IsaNull(cCheck) 1 D0 v4 x. q, G: F
{ & K) q" N/ U- {! u# Q& ?7 r9 X# d$ Q
return(cCheck != " ")
) T- I* F6 D( x( Z/ `1 V }
% K) K! P& h$ u8 r ; o/ I4 L& q; ^+ O
function checkform() 4 i! }- l" n7 L4 X/ ?8 f E
{ 8 c: l7 p/ b$ C- L- A
id = document.sform1.id.value; # e# h8 m9 E4 f, V- P9 y+ U
if (id == "")
! M3 h) r3 k/ T- j2 ^ w {
+ U8 ]1 |" i7 u! i/ n* Z3 A alert("请输入注册名"); 6 U' a2 x; m9 f. `+ S" { |
document.sform1.id.focus(); 9 m8 u J: m% j1 G) R
return false;
% ]( R( C, h9 u# z- s- V }
+ a2 w3 _, |$ D2 P5 X 4 P1 g, P$ L8 {$ L( ?! d7 a3 l
for (nIndex=0; nIndex<id.length; nIndex++) 8 E u# X5 ^, ?! J3 u
{
; u3 e( ^: F+ x3 ?( R cCheck = id.charAt(nIndex);
: v/ p( q, V5 Y1 ^$ R4 T7 f1 r4 z if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 1 W6 s6 W0 ~; L+ z8 g2 l0 A! K+ x
{ 4 ~- R$ _4 |; l: s8 p/ q
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
7 X9 C7 @/ V ~) j/ E document.sform1.id.focus(); 3 a. n3 e4 A9 y/ y s# Q
return false; - J; ?& k' m0 c* u
} : D! m# T) y; R7 I- u$ F6 P+ H- X
} ( S0 W/ o4 O) ~ H
chineseid = document.sform1.chineseid.value;
6 V' {4 Z3 l: _% X if (chineseid == "") 5 C9 ?. `5 ?7 ?
{
9 P* M+ s# h1 W( z alert("请输入中文昵称");
& R: x9 g2 L4 j8 R document.sform1.chineseid.focus(); 8 o0 H1 z- B% m/ k% |
return false;
, h5 w3 r% M) h' _ } 3 P4 o3 `9 Q/ o' ?$ N O
password = document.sform1.password.value; ; F+ \' P* F, @+ c
if (password == "") 3 R7 p2 z1 S% K( T
{
7 \# _8 L* C: z2 e* l alert("请输入登陆密码");
$ a% K. M" J7 z' f6 a8 z. ?# l8 J document.sform1.password.focus();
: J4 r& P" E: n* o return false;
) _, D1 n- }* l. o. F4 Q8 ?, B }
* I9 b9 Y, h4 H( g5 `/ D password1 = document.sform1.password1.value;
0 _+ {4 l o4 r/ I* M N if (password>password1)
8 o# f( ~$ h: W e {
' M* l# r. a8 W. r alert("重复密码与登陆密码不相同");
1 \, m2 y- E2 P- } document.sform1.password.focus(); $ U/ K3 \6 h. n- y& n5 j0 e
document.sform1.password1.focus();
$ u0 L* M$ }% d2 r9 v return false;6 ?% \: V t/ c' n4 Q3 T) W7 H1 l0 `
}
4 x% R1 `7 t4 m# z1 g5 Aif (password<password1)
2 M+ k( A1 d: ^9 V' { {
& D" p; ^1 b' B C: [ alert("重复密码与登陆密码不相同");
% \) K* J* P$ h& p/ e& D9 X document.sform1.password.focus();
. ~6 H9 [5 E/ k6 o8 M document.sform1.password1.focus();
" y1 \. u2 x1 @3 \" Z* v( k return false;. |1 _8 ^. q W- y( f
}
3 k# [7 \' G. m8 ?/ M if (document.sform1.email.value == "")
) t- N/ u% Z; B3 ]3 D5 G8 |+ q { 1 P# J' @+ D7 }& ?3 @
alert("请输入您的E-MAIL地址"); 1 w( j; ~2 E5 `
document.sform1.email.focus();
" Y% I& z$ C, g! V- c, g! r1 U return false; : S, B3 z( i9 K4 {3 L7 U
}
8 a/ d, K, u$ ] + a2 c% _5 c# {0 @
email=document.sform1.email.value;
, E" o7 ^4 @# d+ e2 h N X emailerr=0 |- d" C) `* G' u7 R3 v3 H
for (i=0; i<email.length; i++) , o" |$ u; T4 G k
{
, N, v' G9 K! Z% Y; ~/ k# T if ((email.charAt(i) == "@") & (email.length > 5)) 2 K) j& O5 [: y! t* N" E$ X
{
/ o4 S$ w6 w7 q6 T6 K* B8 f+ i emailerr=emailerr+1
( U) o1 H: `( d, _( G9 o- a } ( y# I9 r: R/ M1 [+ N
} . ~1 q. H3 j2 [+ v0 t7 {# H
if (emailerr != 1)
( X4 L8 m, ?" p! O$ P# |3 M/ x4 p { 2 S2 H0 C* d. x6 T# ^
alert("请输入正确的E-MAIL地址"); : n6 a2 s6 J% V
document.sform1.email.focus(); 4 G. y9 a& b3 u
return false; & g+ V* E3 k+ _
}
, _$ _9 ~) C) _; o $ f6 P% ]# U* |" g
if (document.sform1.checkask.value=="") - o; [/ h0 e6 c
{ % |2 s+ W9 v6 p! ]1 u- c
alert("密码提示问题不能为空");
/ m4 x }0 \" h+ o; T) F document.sform1.checkask.focus();
& b R8 J; }: @! ?& A# M2 F F return false; - E4 Y- A D$ w9 P7 ]0 D
}
% l# e# k H% C+ J1 w if (document.sform1.checkans.value=="")
7 [0 A* A) r! s3 n' K {
3 E5 l# a! J. Y* m; V! F alert("您的密码提示问题答案不能为空");
9 b+ I) \8 l! U, M" q document.sform1.checkans.focus(); / \, c# W* O0 H( ^- N2 ~: V E* S: p
return false; , w( c% r" a& S# C- ^( d/ g- G
}. Y2 u2 g j1 }5 T' n+ u4 m' S X3 X
return true;
& I1 Q8 G2 ^+ q+ ]4 B1 w. A3 ~
7 i2 `$ ~' s1 |) `4 S8 H/ ?: e' Z}
: e9 A) r2 E- H6 a* _</script> |
|