|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14423
- 金币
- 2497
- 威望
- 1647
- 贡献
- 1445
|
这个脚本对你可能有帮助:
/ j! m- n. c( x3 Y0 Z$ a K<script language="javascript">
* t2 B; @3 E8 i$ G+ t: Q$ M2 Vfunction IsDigit(cCheck)
3 S8 S# L9 D1 Q' o& g4 C9 O {
' k9 t0 v* v9 v5 P6 N# t return (('0'<=cCheck) && (cCheck<='9'));
: W3 x, F$ F* a R }
$ ~- Q( W' q; h1 T1 ` , y3 D& H8 r; i' p
function IsAlpha(cCheck) & ?: V7 ^* \3 c
{
1 ~+ ]9 u- x. _3 }6 }& F! p: w return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 6 g- r% b, P) }3 l$ M
} & q# S3 f- K ^
, K# {) O5 W2 D0 X* ofunction IsaNull(cCheck) 6 U- S" V8 n- z- m( ^1 }5 L% J
{
& d: X7 g9 S7 Y& Y& e: E return(cCheck != " ")
4 `$ M" C* v+ [) k s } 8 l6 X; R; e7 r; N( z2 N* y
+ g: P( ~$ w7 i3 Bfunction checkform()
8 q4 _( _/ m5 N: R$ g( k) y: K{
l) F# O, [! S id = document.sform1.id.value;
1 m) U" W4 k) z0 f2 U- M6 N4 D if (id == "") # |: E% \* R q0 y* W! ]5 U
{
9 ]" F5 r6 K5 D( J/ j/ g0 L alert("请输入注册名"); 8 i( ]7 i; _+ u' \" Y" a
document.sform1.id.focus(); " G2 C4 | D t/ ?7 o* {: c
return false; # h1 q" H/ }8 F" ^, w
}
' ]5 |# I; I, @- d" R! ^ i9 |
# F# M% h1 I/ t for (nIndex=0; nIndex<id.length; nIndex++) 4 I# |$ d0 Q* m' A+ g; [9 j' k( |
{ - x% ~) M1 y* J: D
cCheck = id.charAt(nIndex);
: `% }: _) `3 V if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
; C! P& u) G, v( r- U, t4 b/ P { $ m$ |1 g9 d y3 i0 P! ?
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); + L& u) T! e& b0 s; d3 H8 H9 v$ E
document.sform1.id.focus();
+ w' `2 m3 S& L" w8 ^0 r: R1 w return false;
) ?9 {0 K" H! t% V0 f/ L }
' b/ r% q/ b' \ } 5 ]8 K1 L; D6 p+ `# _3 X- C) n+ B0 ^
chineseid = document.sform1.chineseid.value;
2 W' _+ s& M$ {6 \ if (chineseid == "") $ C" z" u; O1 H( k
{ & k0 h Y, A$ c& K E" L# q9 Z
alert("请输入中文昵称"); ; Y' y5 K$ v- S* D4 x! }1 ^
document.sform1.chineseid.focus();
9 h9 m) f( t' r0 t& K K; r1 E return false; & N5 l0 W" A% J0 I) d$ K
}
' x3 R; \9 W9 w7 v+ B3 A( I password = document.sform1.password.value;
( F! {% v* \7 c if (password == "")
& q. a9 Z5 k5 d H4 N {
4 `) H- f, ^" g& m/ {( K! t2 \; `& |( a alert("请输入登陆密码"); ( r" Q. w, \$ x8 i, \9 q6 L; K
document.sform1.password.focus(); 8 p( a r0 @2 y' P( H
return false; - R; P) Y0 t5 ?
}
|% f( `8 m2 W1 } password1 = document.sform1.password1.value;
8 a; G/ w* z1 [5 T( o6 C if (password>password1)
& O! P3 y" I2 D" o {1 N' M8 g1 k- C0 {4 x; V* c$ G2 B
alert("重复密码与登陆密码不相同"); ! L& a4 N, G) A) |, R0 y, q
document.sform1.password.focus(); : ?2 @' ?( F# H
document.sform1.password1.focus(); ; N* q- J& A! S/ f0 `# m' h. f
return false;9 T3 W. W; B1 k" H
} + | K( u& ^6 Q' Y2 Y
if (password<password1)
2 L6 m: Q3 ~+ G/ t) u- z$ ]2 { {
7 @$ [; c" F/ T) K2 x N# g alert("重复密码与登陆密码不相同"); % P! u- V3 u0 [$ n
document.sform1.password.focus(); & G- V( s2 _/ Z0 l; o6 V
document.sform1.password1.focus();
, U3 o: v/ K6 y! e$ H/ K F3 K return false;
8 F# F8 O9 R) C% y } 0 X0 G. n4 D2 a
if (document.sform1.email.value == "") * x1 o: n7 D) ? _) d
{
$ R1 ]7 k$ g3 e* o+ J alert("请输入您的E-MAIL地址");
/ ?# N' F1 [" K& p4 L: d document.sform1.email.focus();
. ]! _& Z* D \! B return false; . t9 J8 h. i% q3 g7 r
} 0 _+ E5 Q; X6 e9 E& B. P A
) _8 w4 C4 f* h
email=document.sform1.email.value;
8 ]* M% g9 o' X: u% h4 } emailerr=0
, ?- P3 W+ P4 j$ O, g p1 l) N" A for (i=0; i<email.length; i++) * ]$ i. H% `4 o. Y1 V. V- x9 j5 m
{ 9 R" B8 K$ \5 y* V/ u5 A( y
if ((email.charAt(i) == "@") & (email.length > 5)) " i1 g1 B/ C! }) {$ E/ e
{ ( J; V, v' n( {6 f4 d
emailerr=emailerr+1 # J- s; d- |. b$ e
}
( w# g9 F, F' n6 }4 @! G, E }
6 A5 m2 C' H7 W3 z if (emailerr != 1) & ^' a) A: C( A+ Z! s7 n$ j
{
7 r9 k. C* F( P% G. N2 [% b alert("请输入正确的E-MAIL地址"); % z9 r& b l1 ]) a# l
document.sform1.email.focus(); o" j% y5 J8 g4 l" I
return false;
! h& k* A; M/ u }
8 ]6 {7 o5 G2 ^+ k) k \0 | * p% }3 l# J6 @0 K
if (document.sform1.checkask.value=="") . L0 p- Q6 Z8 D
{
- d) |# y0 x! t6 }8 ], H& t alert("密码提示问题不能为空"); 3 y: d$ Q9 R# q
document.sform1.checkask.focus(); & Q$ X+ \, k/ h# c
return false; * c6 n( ?, w! r1 x% \
} * l' X9 i9 w6 S7 M
if (document.sform1.checkans.value=="") 9 k. W/ q0 ]0 V; r
{
" K8 u" o$ q6 S. H& S9 X) E7 K1 V alert("您的密码提示问题答案不能为空");
# |/ @! f5 o: O0 b2 `* T document.sform1.checkans.focus(); % E* S; S0 n# m+ b) ~4 X7 e# x
return false;
5 W- D" I& a+ R9 s6 J8 D- X0 u- _ }) p W3 }- c: {7 A
return true; ; d7 x) F2 W5 O4 l# I8 V; J
5 y4 L" t, B" b. g4 A
} - Q$ v* f I( _5 e
</script> |
|