|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:
|9 l9 T$ \( z+ s8 ^/ h, N<script language="javascript"> . ?$ w3 A$ O: K, g5 R
function IsDigit(cCheck) 0 O' t8 q. b" b3 W! T; Q8 K
{
2 S- H& J/ l" b& g: s" `" _+ K return (('0'<=cCheck) && (cCheck<='9')); - N8 C" `) j) Q* j, f( u
}
. T, x4 L, _8 F0 e+ \ Z 6 [; u6 V8 O2 p
function IsAlpha(cCheck) ! l4 n& o: U4 j8 {/ S
{
6 G1 {/ _9 G: O+ G% r4 v8 q0 v& D2 G return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
s. [2 N+ ~# T1 S& y0 B | } ) L* y& N& H; w; Z
- |2 O% s* u: |0 d" t+ Mfunction IsaNull(cCheck) 7 }) B" k, _& M+ g) O
{
6 A( d% X/ e4 L return(cCheck != " ")
- h( W8 N( J5 V" P }
M; h! t# u5 V" q P . S+ M& H, r& \$ r; V3 L
function checkform()
. I$ L' l( p/ y{ & r7 U4 \$ B6 ]3 e; E0 l( b. F" {
id = document.sform1.id.value;
3 o: _0 c3 Z4 Z6 x% F5 m if (id == "") * S7 L/ F$ Q2 W' H* h
{
4 w. c' a( @& h" T5 S$ J alert("请输入注册名");
; e( ~0 S; Q+ V. b document.sform1.id.focus(); 3 b; q7 i! q& H1 O1 q l
return false; $ l# ^( U1 D1 j
} % |, p' ]0 p+ M b# e: B8 u0 @1 @: l
- u3 I# s2 s+ ~ for (nIndex=0; nIndex<id.length; nIndex++) - p; O& O# J* d; z# a F+ O' U* Y4 p, b
{
5 L% R2 m3 M3 d/ k7 [0 u" Q* c. w cCheck = id.charAt(nIndex); ) M* D7 D8 a$ |' ]1 Q# p, | f
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) : I( G v# ]; b* I {+ W& t5 }
{ 8 s% q% E+ q7 ?2 _ ~
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); R2 G/ D! t2 G
document.sform1.id.focus(); " [' o8 V% |3 u; C5 [
return false; : B4 v( d* _# F8 p
}
2 _/ `; a# I& W+ x } ) e) p' M. L0 B9 E3 f$ S) [' a0 h9 ^8 j' K
chineseid = document.sform1.chineseid.value;
( I1 G" l+ P1 O8 E% n# Q if (chineseid == "") 4 A# E5 \3 Y; X( J& y
{
* ^+ |' a5 |7 Q alert("请输入中文昵称"); u ?/ V r* v" W) M! T
document.sform1.chineseid.focus(); ; o$ ?; z5 q1 p' C
return false; ( O5 o% f) X" |$ Y0 p
} 7 ^5 V. ]: u5 G4 F
password = document.sform1.password.value; 0 c4 m: F: t0 F6 P" m. D
if (password == "") ! {0 h3 ^2 e, @- o- q
{
9 }0 Z& b9 e0 S alert("请输入登陆密码"); , g8 I/ c: u2 Q& a" U0 \
document.sform1.password.focus(); D z2 Z0 T5 q$ E
return false; 1 E- |" j& Z l/ ]+ }! M) z
} ; J" i- ]$ I1 W2 Y/ _8 b
password1 = document.sform1.password1.value;
! E% C* |5 s' n4 n- J& y if (password>password1) 7 s$ k" D1 j# \, E; u& ^
{
# r7 c$ R& I$ f( m6 P1 b$ q1 R alert("重复密码与登陆密码不相同");
1 `+ N, N2 n( P( y document.sform1.password.focus(); & }8 W; p! |# l% E
document.sform1.password1.focus(); 9 o! k5 Q w/ T! y7 S
return false;6 Q9 N! K3 ?- l) e8 G$ @+ d& [
} ! F( Y/ o+ \# t( E1 A# N" E1 C
if (password<password1)
, _) @" T0 w& ^( s( o {
# G2 t; ^1 ^- F, h/ B alert("重复密码与登陆密码不相同"); / a; O, N, f' x0 _! l% c
document.sform1.password.focus();
+ o1 W. q9 L. P3 R2 p4 R9 n7 T document.sform1.password1.focus(); 1 e- d6 g8 B% s
return false;# H! w4 H6 ~" e6 v v& o
}
( _# c. y0 f/ [, _ if (document.sform1.email.value == "")
0 R+ @, b1 v* ^% s( G { - I+ G- n* M# {6 |; B
alert("请输入您的E-MAIL地址"); 5 F7 _/ V" W' A( \ y
document.sform1.email.focus();
4 Z1 y/ d+ f, x( I+ d& t return false; ) D; H, X4 G ^. r8 y* R
} / i8 g+ g: P$ s+ u; t
& C/ a, t; Y b$ n( o# z: V) D
email=document.sform1.email.value; 7 ~* @% N. ?5 ^9 C# m4 x# k
emailerr=0
( ^6 ]: ~( M4 {/ S/ W for (i=0; i<email.length; i++) ! p' t# v% v- x+ X# K
{
# @; V1 o% ?- R if ((email.charAt(i) == "@") & (email.length > 5)) . |5 o% O, t: f, A
{
5 f" X% e3 V- v( ~ emailerr=emailerr+1
* ? Q1 O% X# m6 ?1 ]$ ~/ l }
& a, M0 `* B, q, x }
$ x. t3 y+ b% u if (emailerr != 1)
! S' I& w- d0 o' k {
! P- v; o# c1 |$ N4 j alert("请输入正确的E-MAIL地址");
& E" m' l8 P3 |( e document.sform1.email.focus();
" ?: k/ v3 c8 G, C7 U8 T# { return false;
9 p% } Z( x4 r# F } & [8 {' j5 {# q( t0 m% x
* `# w; x/ @- |! ?( h% Z
if (document.sform1.checkask.value=="")
. m+ N' U, B2 l5 g { 1 r: @1 X% p" k" P3 s2 \4 b0 [
alert("密码提示问题不能为空");
" f# Z% H2 O5 h/ D# D5 ^; @ document.sform1.checkask.focus();
& a( d3 n+ O8 ]# i6 x' T return false;
! Z7 a! v2 \0 K7 ?' Y) P, k } / e% ^2 _, N3 ]1 O
if (document.sform1.checkans.value=="")
! O8 x* c. @9 K7 A" g { # `; a) @$ Z# i9 U7 `8 f5 v; k6 f
alert("您的密码提示问题答案不能为空"); - R$ k* a2 ]) u, [0 ?2 U
document.sform1.checkans.focus(); & h) P) A. Z% D6 h! h! ~
return false;
: _0 v0 t+ i' q' H* a2 T" O }
5 H4 e" `( ~) Z, a; r/ T2 ?. U$ r return true; ( y( d7 n9 I. v! \' V1 \5 a4 m
2 h& q2 J0 n% E. k
}
+ G8 X* J! R+ F3 }0 b</script> |
|