|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14419
- 金币
- 2495
- 威望
- 1647
- 贡献
- 1443
|
这个脚本对你可能有帮助:
$ a' M; @ h. N+ [' i6 @, N0 W2 h<script language="javascript">
$ E) X$ j$ G' `: N9 Kfunction IsDigit(cCheck)
P9 t/ A5 N( V# | { 2 @2 g7 ]$ C! u# _1 @% Q
return (('0'<=cCheck) && (cCheck<='9')); 9 D( y; g; D$ L$ L- ?7 ?
} ! R# B' R! I. P; c/ ]/ t, p3 |' S1 R6 N
2 ^: c8 c+ d4 t! y3 D9 ?
function IsAlpha(cCheck)
4 h) j7 U4 f: g1 y5 D {
# g* a9 X3 m5 Z' n. J8 V return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 h6 E R) z/ ?, Q8 q% p } / P& V; N# o1 Z# n% S, k
/ ]1 E7 [3 {" v+ K& O: e9 d
function IsaNull(cCheck)
; A- l" t" o& i+ c% [7 w { & B! [, c- X1 j
return(cCheck != " ") 2 ]" ]' X5 a" A8 c; E
}
3 X8 b, ]# \9 F$ D& B9 F 9 ^7 N. }; w |9 n6 F
function checkform() / ` j4 O4 c% Y; R E( ^, v
{
& y0 C) K: |0 G id = document.sform1.id.value; 9 t* q2 K0 z7 t( j2 u" e$ s ]
if (id == "") ) W. a% S0 [3 J( q1 f
{ ; V# `0 N, y4 S1 e
alert("请输入注册名"); 4 l4 U- ~/ m% F9 y* U/ f
document.sform1.id.focus();
+ d3 l# f- w, R. e7 V return false; * x7 ]3 Y. w: O5 N7 T4 c
}
; q6 O$ X- m" [0 s 2 K7 s# b& Q* H3 M3 j2 z: f7 X3 g2 H
for (nIndex=0; nIndex<id.length; nIndex++)
$ J& e( n2 N3 Z5 h; A4 B) q { 2 `: O% n* K# Q
cCheck = id.charAt(nIndex);
: _+ D# `! X2 S/ h4 X if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) + ]+ W F+ h: E$ g. X. C
{
# [. v% l' I: t% _. {3 J alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 5 O; `/ ]4 W1 ~* @( q A3 a, C( _
document.sform1.id.focus(); 6 ]. D, y3 P* F9 c# G
return false;
, `7 n9 J, x0 p; N L }
0 ~2 `( V! _2 P- V* C } $ f! X( H: K3 }: [& E( c9 a
chineseid = document.sform1.chineseid.value;
+ l6 R; m+ m; a, A% `( r& g if (chineseid == "")
5 u5 k7 F% O- | { * F3 \5 z0 \1 R5 l4 I2 Y
alert("请输入中文昵称");
! ?( X7 b( G0 g- M) K! i document.sform1.chineseid.focus(); % M" U: _# m0 w4 w# X7 ?2 U
return false;
: Z8 ?9 @- v7 l1 L' g( y }
, r; u0 l% \& y1 a2 K password = document.sform1.password.value; 3 f# k5 X0 u$ T ^
if (password == "") % o4 O) V3 Z' n2 A+ ]
{ " z5 s, Q+ ]; \1 i
alert("请输入登陆密码"); ) O7 D1 }# ~( S5 k3 W( G, G& o
document.sform1.password.focus(); ; I% ?5 _' E' l( Z7 A7 ^! S
return false;
5 s7 q0 H( M p3 A% O3 _ } # I& X5 J6 @( W6 W( V
password1 = document.sform1.password1.value;
1 t9 Y3 D. o: v' N! l, t1 g0 O) t if (password>password1) & o: r. ?4 R$ \, _2 q
{
4 o1 N& e! P4 t1 Q# t alert("重复密码与登陆密码不相同");
2 V2 {$ p5 a' g$ }% q) u; J document.sform1.password.focus();
3 ?, y, H; p4 s$ u, } document.sform1.password1.focus();
, ^3 D% L* x5 m% ?2 H6 W return false;
& l( [$ b9 F4 Y2 k } 5 o* b; C% X* ~8 v
if (password<password1)
. Q& A9 R" x3 c$ Y/ M: D {/ W. r7 C' c1 J) o
alert("重复密码与登陆密码不相同"); 9 }: ]. I- u; T
document.sform1.password.focus(); & I5 {8 y. A& @+ j, n( [
document.sform1.password1.focus();
, ]' P; i" B( V1 @+ T% g! I return false;" v9 c; H1 ~4 d1 k8 b! T' g( M
} 1 r# D1 E% o! N$ `+ N
if (document.sform1.email.value == "")
3 {! B& Z5 \) ] { ; ]! Y$ y2 n! d- X8 m1 V
alert("请输入您的E-MAIL地址");
% I3 B: P" @; S3 K g+ Q7 Q document.sform1.email.focus();
; E0 ^6 K0 ~. u x return false;
: v/ R: ^" a/ ]0 a8 P& k: f }
! ^; y+ Z! {; k7 C0 f+ W7 b g2 Y I
: {: G; x- Z" `* N3 b email=document.sform1.email.value;
0 n7 ]0 d x4 ]# ^ emailerr=0
) b4 }& u$ E3 E9 {3 w for (i=0; i<email.length; i++)
+ a) c. U7 C2 {6 m { : u, i2 I+ B7 [- @; r( v) V. X
if ((email.charAt(i) == "@") & (email.length > 5))
8 n- @5 A4 W) m5 h* e* q$ l( Q- n8 Q {
. z) k7 G4 R2 X emailerr=emailerr+1 & x5 v# m/ Q* P, k N
} 1 @1 b' d$ H7 @2 c8 A
} - g6 v, p7 v3 P$ l4 N
if (emailerr != 1)
: G' C) w6 D. F. e8 T3 d- B; O {
4 C2 g: u8 v: E8 H. G alert("请输入正确的E-MAIL地址");
+ n8 U, l( F' R( |; ?( e/ R V: f document.sform1.email.focus(); ! d# O+ A; i- H$ f9 s' g# Z0 |! r
return false; 7 U3 D: ]( J7 `: R7 ~5 c
}
6 |: d2 Z* Y6 p) p" y/ \ , G3 u+ r3 N1 v/ L
if (document.sform1.checkask.value=="")
. d) G7 I" m5 P5 ` { 5 X) a: Q) S- ^; ]: G
alert("密码提示问题不能为空");
1 c& k$ e: b1 Y5 ? \# ~& l document.sform1.checkask.focus(); 2 _* z1 b; r6 f i
return false;
6 ~. s2 |. E4 q. x: m }
' P1 o2 K4 P9 B2 I* l. k6 h+ R5 S. p if (document.sform1.checkans.value=="")
8 X% o, [$ `" T& J1 `5 U {
- K8 v, j& ]. k3 M* o alert("您的密码提示问题答案不能为空");
; G- L+ c2 L6 ]0 ]' T document.sform1.checkans.focus(); + \. m/ H& ~# V% D1 d, t: z8 E H1 A5 ?
return false; 6 }. d- ~# P8 o- q
}
+ w# O1 u" I3 ~! ]9 D# l$ { return true; 2 q& k- s8 l& a# H
+ x$ U+ U# A _: ~+ i}
# c1 \! i' G' x9 j( j4 W: ]</script> |
|