|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14421
- 金币
- 2496
- 威望
- 1647
- 贡献
- 1444
|
这个脚本对你可能有帮助:: E2 i: N& ?# |. N. x
<script language="javascript"> 7 P7 ?1 V8 M; c2 F. [
function IsDigit(cCheck) : [8 F- D9 W. |# K5 d, w7 }
{ " s; B/ {' u* E9 j. l
return (('0'<=cCheck) && (cCheck<='9'));
1 U' m& H* A% x( T* t- G }
; p7 @# r% e1 i- L# j% u ( `; V ?: q9 `7 y5 I
function IsAlpha(cCheck)
! f* m# x) S+ q2 l5 p { - B' w9 V, b) W, w
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . ]" K! e% n$ w
} 5 X( {2 z* X1 N
3 ?4 _/ K2 `* o" u/ N( }
function IsaNull(cCheck)
3 m1 X* u, F* f- Y' M+ i- U# X9 c {
7 h! m9 ~* P6 u" s return(cCheck != " ") 3 R" E* S+ U i$ ~0 b2 ^
} / J# K5 e: q( i' s( a. R( K O
0 w+ ? E8 d* _& p8 m. N/ B ]! Z' nfunction checkform()
3 N0 ]) }: F! M; C* f{ 3 W6 C: t, z! [/ I* @
id = document.sform1.id.value; ) D# J* x |, [' Y, x6 I
if (id == "") 5 c1 R6 y) z* F% e' u
{
: n4 `% H& {% ^# B! {' s- {% i alert("请输入注册名"); * J$ P% c& ^# y0 o9 I
document.sform1.id.focus(); - x& b7 [/ {# A" P* k* l! C
return false;
6 l2 v. U Y+ O/ h) o- X5 L' @9 r }
) ]3 u0 W$ @- X2 _4 ^ ' \0 V! U/ `' N
for (nIndex=0; nIndex<id.length; nIndex++)
8 C" k$ V- A% Z; W6 n {
- J/ R* J+ b2 _ w cCheck = id.charAt(nIndex);
3 o2 d: W/ `- ?; P" i1 w [ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) % H0 o) A$ v- \9 ^* N% E
{ & T3 B% u* z1 z( E* S# c
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
^2 Z. J: |& O document.sform1.id.focus();
; d* K5 l+ q: S5 ~ return false;
' T3 ^) _& N+ |) A }
0 i# X0 J. I! I }
3 y& Z/ ]4 |* u# D: B chineseid = document.sform1.chineseid.value;
- D* |9 L+ S% q if (chineseid == "") % N! ]6 v1 d+ L9 _) w* x- W
{
) g# N) T6 M& X alert("请输入中文昵称"); 1 f+ f% e7 Q9 z# {( b6 n0 M, i
document.sform1.chineseid.focus();
/ r+ s$ l1 I" l. J/ T; G return false;
: B" Y/ G/ q4 L1 C } " ?. [, C3 Y6 F% ?3 x2 w
password = document.sform1.password.value; 5 @6 `( B% w2 j) Q: ^9 _
if (password == "")
8 K" G* p. X% @+ s+ b4 I9 d { 1 u9 A8 k" ?; F7 Z' w$ h M; C
alert("请输入登陆密码"); 6 f2 a3 O( F; z2 f$ z
document.sform1.password.focus();
& [0 a1 a8 ?7 Q0 u return false; 8 i2 p2 k' g# x
} & J5 W* |. f7 }7 V# } b! ]9 N4 a
password1 = document.sform1.password1.value; ' a0 p1 E/ j/ v6 H. a
if (password>password1)
% b- I, O# W( D' `7 p {4 A0 q7 d% Q( ]+ V! c; T
alert("重复密码与登陆密码不相同"); 1 B+ s9 g2 ?+ \
document.sform1.password.focus(); * n& b! l+ e( C6 |
document.sform1.password1.focus();
. |. O' o. e' n: u) B6 B/ B return false;; C# M* V$ V4 v* v
} * f- c J+ f7 L9 r4 K+ O
if (password<password1)
9 J- I4 o. |/ o7 i8 y" e4 D5 _. k k. @$ a {! a1 P% y' I- P0 U
alert("重复密码与登陆密码不相同"); / G% S$ o5 { N' u
document.sform1.password.focus();
& E& b' V8 h5 M1 p( Q7 Q document.sform1.password1.focus(); 3 A1 c5 }& f# t: N% _
return false;
- f- E1 k+ K7 }2 h }
( n4 K$ I: P4 c. X+ o0 h if (document.sform1.email.value == "") & P7 n! E. z7 Y* t0 g
{ , @" K$ a) X* D* Y* y7 [/ M4 s
alert("请输入您的E-MAIL地址");
2 q" F0 E; P6 J' o document.sform1.email.focus();
3 t* I0 \$ _* w# ]8 F9 ?% [ return false; ! O0 ~& H/ l5 Z) r$ W7 {
} ; [" w5 I x1 B" U2 L4 J" ?! J1 P1 a$ i
: H" u/ T: e3 _8 W email=document.sform1.email.value;
) |( q A7 j, ]# W emailerr=0
, j/ \4 k0 g. n, E/ \0 Q for (i=0; i<email.length; i++) 8 D) `6 s4 I/ A0 r% M2 H4 ]
{
7 Q+ ^2 Z4 L y* ~( F- F# A, p1 u* t if ((email.charAt(i) == "@") & (email.length > 5)) 0 i. e( n; m1 c" C3 A" S
{ 1 a3 \/ ^& t5 Q
emailerr=emailerr+1
6 V. `# y! ^0 X0 r+ O/ K! l3 A+ h, J } 7 x4 z) N5 @6 ?. q
}
( f% O) N6 T: j( P E q8 q# V if (emailerr != 1) " m# z" d" h" u6 Y
{ / L e1 ?% }3 X7 d/ O4 X
alert("请输入正确的E-MAIL地址"); 4 Y7 m2 t; z O: a
document.sform1.email.focus(); , u% X, e# s/ n$ [4 {# E
return false;
' h0 ~" U# D b% V } " ~: j$ |1 y, `& f( E' S+ U; ]
* |6 A3 s6 J/ T8 N5 k) L) V if (document.sform1.checkask.value=="")
6 u$ Q4 _ i0 F2 ?: A {
! K& `: V6 R# h" {: l3 m; g alert("密码提示问题不能为空"); % a+ f" c) h5 b% |" t4 H
document.sform1.checkask.focus();
: L% s ]; z' B, D ?% } return false;
$ _( C9 p9 |( s9 e* D" B1 u( A1 v5 J0 | } ' x( _" Q$ _8 [& Y$ X% h) ]
if (document.sform1.checkans.value=="") ! E3 H& c. _6 G1 _- _& Q1 h+ @
{ $ ? F, M6 c+ ? {" Q
alert("您的密码提示问题答案不能为空");
( n# b3 G' ^- n5 R8 Q1 s document.sform1.checkans.focus(); 4 ~7 y3 [: @/ l# ]; P
return false;
9 O: }! [0 T$ f& t f" c }2 ?5 z' @' @: Q* {( H8 Z# d5 Z8 h( A
return true;
9 Y- v' n! O" _* U7 |8 p
3 d+ ~$ X" B$ l}
$ V8 j& {3 y( ~8 H+ B8 ?: o1 w6 c</script> |
|