|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:! Y; D5 O4 t$ p4 J. v$ Z
<script language="javascript">
+ ~- c" F3 U8 b- o, t; Q( Z# gfunction IsDigit(cCheck) + Z3 A! _; k8 p6 p* v/ R
{ * r0 g2 X* O& I( T
return (('0'<=cCheck) && (cCheck<='9')); 3 i1 F2 L0 D0 o) a
} : S0 D) O% u2 i K
# \& I$ `5 d% f; ^6 ~* n/ w3 J
function IsAlpha(cCheck)
( i1 `1 j& q: Q) X) O { 9 A' C/ d7 j- E, \9 O7 G. Q
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
4 r l) Y8 V% i% L! y9 I+ a } * c+ H1 _2 Q+ j% ?( L7 j
/ p9 s$ S4 ^ |function IsaNull(cCheck)
% g( @( P6 N3 {- p { * q4 t. O( y+ x+ @* ]7 }
return(cCheck != " ") ! T) J& k3 p* ~! z* M
}
' X$ S; O6 ^' P i5 W( G( l ?: s2 T0 V0 ~( P5 b2 |
function checkform()
& K; U0 G7 m% \8 p( A G1 W& q{
6 @5 j/ J8 Q" O+ r# p! G id = document.sform1.id.value; 1 \7 J6 B4 c0 q8 P7 E; i x
if (id == "")
2 z( L+ m! T0 G$ n {
. |# ?- U6 v: [ alert("请输入注册名");
) z+ D0 [. \" k document.sform1.id.focus();
0 W; y9 x" C2 L/ X- f return false; % a0 O i! V0 v; k9 ?
}
9 {1 o2 T d' m, o
' X4 J- a6 }+ Y5 w for (nIndex=0; nIndex<id.length; nIndex++) 4 x) L! V4 i$ Q5 Q% d9 ?* s0 A
{ " r! _. ?& A- X2 ~& \0 n% C5 L
cCheck = id.charAt(nIndex);
" {- L0 I; P4 l if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) l% z' m& I' G* A1 Z# b
{
1 Y6 U2 Y& E# Q alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
+ V8 J# m+ G$ Z0 F1 q7 [! v; p document.sform1.id.focus(); o/ S# M( r. K3 Z3 q
return false;
( b0 r" ^ }! G' l# O } . ?; M: I7 D6 u' v3 P. `, @
}
* C6 C: G% ?8 u. R chineseid = document.sform1.chineseid.value;
0 z+ t# S g6 h" }: K( z if (chineseid == "") O! K- C- l- L) d, z" O& `$ B
{
4 k3 a3 U; k0 k" j! s( I0 j8 n$ R alert("请输入中文昵称"); . R7 J. K0 z) E( g$ t7 L
document.sform1.chineseid.focus(); . I+ K. Y, K# d
return false; $ i1 ?+ M& O3 n) x; x' ]; |- Q' n
}
+ O/ ]! w8 C0 L# k password = document.sform1.password.value; % a) Y: Y! Q: Y" g% h
if (password == "") % y) I& E' T, k- X
{ $ S/ [# a0 [6 f" S
alert("请输入登陆密码"); ; h; Q. P" h0 o3 O& ?$ f
document.sform1.password.focus();
" L& {2 s) {- b) V6 Q6 n1 y return false; . m; M* ]. `4 O
}
' X! `+ q) U/ W0 O password1 = document.sform1.password1.value;
' ]5 Q( L* i' _0 M) z if (password>password1)
( C1 s. R$ I) ` b: H9 H7 Z7 [ {
- F& H- E D2 o4 A8 R# p alert("重复密码与登陆密码不相同");
7 ]1 G1 M8 p! @ document.sform1.password.focus();
8 w- ]1 N) ~: e- L# R" v document.sform1.password1.focus();
/ C) A% D H+ a) w' b, l# e return false;( Q' }$ n6 B% e, k' E8 f. O
} # d3 v) J, H; M, ^2 L) O( x
if (password<password1)
- B, g9 s" H; H9 } {
* O! D& v) N- a0 L alert("重复密码与登陆密码不相同"); / Y) K* F" i" e* q6 O( a* g
document.sform1.password.focus(); 5 S# q5 ]: D1 u! b) P' J$ K) B, j
document.sform1.password1.focus();
5 W' n/ y( J1 P2 { return false;& u/ o# ^2 ?9 k) T) K
}
* S/ D' Q1 Q' k8 f if (document.sform1.email.value == "") $ \2 u8 r4 q( A/ J( f
{ 5 G1 E; E" h! [1 q6 m. a- p
alert("请输入您的E-MAIL地址");
$ \ C5 F/ O1 t document.sform1.email.focus();
8 z1 ?; N( E$ Y) w g" F' M/ Y return false; 1 _' t x' F. {- O
}
# X1 j3 G7 x, `' i
, v' Z* Y7 k6 L3 N9 F email=document.sform1.email.value;
6 G2 j' [: [8 i0 m emailerr=0 1 Q) \) D' f/ E
for (i=0; i<email.length; i++) / Z5 Z" }# D) h% f! @, o$ F
{ ' l; i# v. R' R% O+ ^- k
if ((email.charAt(i) == "@") & (email.length > 5))
5 e( R# h, z# z3 W {
2 `, b- N3 ~* W: T! m emailerr=emailerr+1
7 }8 z4 ?6 w. b& [) ]: g }
' N( C$ I+ y0 g+ J } ' U" Q2 ?+ N, Q* N7 K* D
if (emailerr != 1)
+ m/ I* U8 [- d m( \ {
* C( K& k# e6 [' j7 C$ ] alert("请输入正确的E-MAIL地址"); / A- o( n: l" F% A: h
document.sform1.email.focus(); 3 {9 E9 j& b1 L6 E8 T( I
return false; : ], j/ R" I) w! Y' n7 M
}
) u$ A) P. Y( N& q5 Z* f
$ E# V( m2 S( }# \+ q% b if (document.sform1.checkask.value=="") & M7 q8 H- f; b; b6 k
{ + q/ b" h5 x1 k! K$ X
alert("密码提示问题不能为空"); / |+ K8 s+ Z/ p9 W, f* O
document.sform1.checkask.focus();
, `& U& q9 Z8 @ return false; 1 S) T S/ y% o1 p$ Y
}
+ A+ f4 c- I+ ]% L1 ~6 g if (document.sform1.checkans.value=="")
8 U( V% e% Z w# O# U, I! F { ( [9 O$ y* n/ p& S( `( P
alert("您的密码提示问题答案不能为空");
6 L% ]7 H% u( S* \, k7 \ document.sform1.checkans.focus(); ! S8 j9 ~) m: {, [. A5 p
return false;
* W% y. P% L& L6 ^8 H }
0 T& N3 g/ ^5 T( _; } return true; 4 [' W7 J7 y6 _* S, x8 [- B
3 t& p, I1 E' S/ G
} 1 e; Q- h; i- o& F( i1 j
</script> |
|