|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:' b# x7 h& B& W; `
<script language="javascript">
0 Q0 Z5 x; b3 m0 r1 @: Efunction IsDigit(cCheck) 4 H& X* W- e5 i, b
{
) d b& a; C# c/ z9 T- e8 K return (('0'<=cCheck) && (cCheck<='9'));
! W: e: j _5 k/ S& C5 C }
5 c4 ^1 n6 Q% u9 L+ x+ Q
2 s: b% v) ]) M( K8 A- Hfunction IsAlpha(cCheck)
# r% Y) d: z, ]* @ {
$ I ?+ @' `! ~ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 a6 L. L* {+ N+ F% s Y2 f% |- ?1 o } 5 A. g. X0 X7 M+ N7 R
2 z' I: l5 t6 K0 n8 O7 x+ x; Dfunction IsaNull(cCheck) , N5 H- \6 I% h U( [& J S& \
{ : @; A _1 H& c5 b2 v2 X
return(cCheck != " ")
6 o8 {- P: s2 B! }7 | }
' w/ w; \. R- |* r# {
" i& ?& C, }! F9 D( H3 ^' y- R9 S3 t# Mfunction checkform() " z% }) x/ x q# G
{ 8 Q4 r7 S9 y; j" }/ e
id = document.sform1.id.value; : f" Y2 a7 @! v8 ], {; N! W
if (id == "") . z# L( c9 r) x& R
{
6 `, Z5 `; n! a0 U7 x, s& P! H alert("请输入注册名"); % C4 n7 O( N: x) V' M- t
document.sform1.id.focus();
! ~6 R, K4 O" u return false;
6 ]* g, m0 j9 m: N } % y2 u8 h7 Z% F8 Y/ n: D! b7 N
x% C2 p6 j$ J7 ~* b+ D) X$ l( l for (nIndex=0; nIndex<id.length; nIndex++) 5 N) Q3 s o' W3 S1 @" q
{
7 z4 z8 E: ]6 a cCheck = id.charAt(nIndex);
) N7 f( {1 o# B/ p if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 ?! e' y$ _3 G* n( N4 V {
( m' y6 V+ r5 p% r2 z# z alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
3 G4 ?# X1 X+ i7 H p) Z document.sform1.id.focus();
1 K) r# R v1 h* f B# e return false; 8 I- o) I' \( G% C2 _8 y I
}
0 G+ y* x8 l4 r0 L8 j" y+ U }
k a7 W+ `. h- N8 m chineseid = document.sform1.chineseid.value; + L$ d4 |+ L3 B9 w3 ?
if (chineseid == "")
) B; N& u6 R# x, m2 t- ~4 \0 A } {
. \- F8 ?6 N6 ?# p alert("请输入中文昵称");
. A" P1 W, }# ^: e document.sform1.chineseid.focus();
; n1 m5 [& L& v. S( ~) y4 H return false; 7 J6 z* [" h" n d) D) f& x
}
8 H# F a5 v: j+ s* i) ? password = document.sform1.password.value;
% M0 E$ F5 i7 ~$ B* m% \' I! W; c if (password == "")
4 I1 Y% k5 S. H+ F5 i* K { % K) |& T- ~6 n! P* g0 o& K& @/ S
alert("请输入登陆密码"); 6 t; C# a8 {2 F' e
document.sform1.password.focus(); . Y* d) B6 _; r3 h' F" W. m
return false; ( L' D, U" a% J1 ^
}
: [4 W1 g8 b4 U) u( Q password1 = document.sform1.password1.value; 9 \. t* ^7 ^! B6 f6 c; V& y
if (password>password1)
1 |7 ~' N, o. F2 F3 G# s {# B) ?* j0 ?- y3 D! C
alert("重复密码与登陆密码不相同");
3 a- j5 R! r* @8 D2 W document.sform1.password.focus();
' s2 g1 T( n' L+ l. O' D* d document.sform1.password1.focus();
4 L2 h( U7 }1 g1 Z: Y return false;
2 W1 N1 d! { q& w3 A# u }
* I. W7 z: ?9 Wif (password<password1) W+ h" E" m/ t- {" }" O* p
{
( G( M) }+ j9 w9 v alert("重复密码与登陆密码不相同");
0 h! {, X; U0 x% c- V' q6 s document.sform1.password.focus();
6 R$ E' k; S5 d; V) Q document.sform1.password1.focus(); " F$ ?3 `& _6 v( V2 p, r' W
return false;9 S8 C& o) B o
} 4 t0 h0 ?8 p$ [
if (document.sform1.email.value == "") , W6 L" ]1 M: \6 R
{
' s8 Y, K$ ]4 w: z8 s7 Q" M alert("请输入您的E-MAIL地址");
9 L# N d# L- }4 Z document.sform1.email.focus(); # i. i% [3 \& Y. t- e& ]; x$ c
return false;
6 |' e2 v/ p; P. ^ }
+ R6 {6 e4 H/ k9 W$ t# Y / C/ I C5 ?4 E7 d" q; F3 u
email=document.sform1.email.value;
* e" @* O6 K! {2 ] emailerr=0 1 n/ A9 U: E+ r* }0 G! H2 q7 y% m
for (i=0; i<email.length; i++)
; n, P) a9 |" b8 ?! w {
8 R/ _$ j+ k- e1 y if ((email.charAt(i) == "@") & (email.length > 5)) 9 S/ {) u& M7 ~% ?& `- @
{ 7 v6 M- S& u/ F2 j) b
emailerr=emailerr+1 ' o* U! h) G1 _
} $ s; e+ s/ t3 [7 R: D
} ' G5 ~$ @% J# S* x
if (emailerr != 1) ( m& ^/ N9 G! G' @% j
{ # ]+ c. g. X/ r$ ]
alert("请输入正确的E-MAIL地址"); * z* G/ p; c: k
document.sform1.email.focus(); : w4 B( ?; L5 @5 ~# ?% O
return false; 9 g9 l# d7 I, \1 C* G: c8 g* E
} 1 J: }# Q0 l7 G# V+ D6 ~; E7 `
: \) n% W5 Y, H, w8 h if (document.sform1.checkask.value=="")
4 e# Q; c9 x/ ?; A8 g" E) L {
- N' Y& X5 D* t0 K6 K alert("密码提示问题不能为空"); $ R$ [/ u9 u0 Q2 u' B" u
document.sform1.checkask.focus();
. H6 H' e4 f8 b: x/ } return false; & z% L( D3 ?$ ?7 p1 l
}
/ C+ B/ M' h/ {& z! f* f/ ?- g if (document.sform1.checkans.value=="") 5 l: c6 F5 m3 m5 n/ h' m8 f1 ?
{ # y% O# b. e' w2 x; \/ D* O
alert("您的密码提示问题答案不能为空");
" m9 z$ Z% d* o9 _7 F$ L# p/ N document.sform1.checkans.focus(); & t [- x2 E* {5 n2 Q4 O
return false; ( o( K7 m- m. C C
}
. z: z" D& d, ^5 m% t( y) j2 B return true; 9 ~; _( |- E$ O3 a( I
& r- h' u9 }2 t% K j! d7 i}
/ p) \& k9 j% v- y! \</script> |
|