|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14349
- 金币
- 2460
- 威望
- 1647
- 贡献
- 1408
|
这个脚本对你可能有帮助:
+ S* k% G$ i `* v, Q4 B<script language="javascript">
, T) p5 S8 h8 D# C' ]" Cfunction IsDigit(cCheck)
3 C( e* Y/ g& ^( h2 v3 Q5 @ {
0 i6 l+ m0 G$ {2 q, w return (('0'<=cCheck) && (cCheck<='9'));
( u6 n( A) ^# q) i }
# N ?4 q8 m, V H% J" J
* N7 ` T$ r, ffunction IsAlpha(cCheck)
7 @6 | ], `0 q: |4 D* u2 k2 J2 I { * o+ X; a0 h2 h
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 1 D, |0 |! U# i( M2 m
} ! h/ M1 V( C6 o/ H* g9 ^2 e
. \( \) N n+ ?
function IsaNull(cCheck)
2 F( a; {8 d) U7 ^& q$ b) u0 M {
+ T" z8 [6 \5 _- c0 m+ U return(cCheck != " ")
" h! \9 D' V/ f n3 Q }
. A* I- |0 n, e; [, u* _; \9 x" o, u
3 `7 R7 P" z4 Y) Pfunction checkform()
+ J. {6 n5 @4 X; l4 X{ + @* G1 H5 z8 J7 F0 h: {4 k7 ?2 E% k6 T
id = document.sform1.id.value; 9 s1 H% Q0 H2 g
if (id == "")
' n7 |5 S- }" u4 w {
( _. G6 S! H0 O4 A' j alert("请输入注册名");
+ I6 }. R3 K: m# Y% V document.sform1.id.focus(); 2 A7 ~# N) `5 i. }% _
return false; f5 `+ K9 ?* P2 \! n- S
}
+ @& D7 g2 ~6 ^& l( R5 Q
9 C# ~2 x7 e9 f for (nIndex=0; nIndex<id.length; nIndex++) ) ^6 @3 v' t3 d
{ 7 X5 x! G7 U1 a3 C
cCheck = id.charAt(nIndex); ' l) j* }7 r: x4 y/ c# o
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) " Z3 V. t( z8 B3 m
{ ) Z# E! |) C; s- k r2 x' x
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
9 s3 C+ s; e. k1 i document.sform1.id.focus();
( w3 d4 J' K1 |' [0 ?9 @$ J& l% J# o return false;
4 u! V m$ c( R( Z% z' F- `; j6 ^ }
5 r& o2 b0 K* Z1 b4 E- g# h }
) x/ c8 @+ w4 b7 A/ R chineseid = document.sform1.chineseid.value; ) [4 \# Q: n- l9 ]
if (chineseid == "")
6 U/ T5 i4 ]3 T# g4 W" \) g { . i5 n& y7 a' L9 ~4 c8 [1 G
alert("请输入中文昵称");
4 g" J7 x" }, Q* A9 Q4 @/ t, ]3 s document.sform1.chineseid.focus(); k. q: e' Q) t1 P9 a( X9 Q
return false;
# J4 [9 I2 B. y6 t7 l }
4 |% e& [+ G! p* k# P+ w5 s password = document.sform1.password.value;
, v7 Q8 d/ j; }5 {* e if (password == "")
& z1 r7 w. Y( x. D& v$ d {
- H: M2 O, e1 O, `% B+ R8 u) w alert("请输入登陆密码"); 7 e! R7 D' C6 W2 ]0 {8 _# H
document.sform1.password.focus(); & p3 Y+ Q' q; u+ I+ U
return false;
) x* G5 [: ]4 U$ J$ v1 W } H4 C; _# W+ \8 o
password1 = document.sform1.password1.value;
4 U/ b# Q7 W1 j; @$ W0 e$ t5 G if (password>password1)
3 |: b- o7 K7 x. U' p' ^: J {
/ R7 X4 i) V) Z2 N alert("重复密码与登陆密码不相同"); # ]2 \4 n6 ~3 @2 K
document.sform1.password.focus(); ! r0 c5 U# D; `4 x: H7 a( M
document.sform1.password1.focus();
! r7 B7 d; A5 p G6 n& s% j5 w4 m1 s return false;/ A- g% P6 A7 `! I' H9 _
}
4 B* B/ _1 N; P9 Mif (password<password1)
( R7 M( ?6 m- m( |3 {, P$ w- _ {
4 t: u" `9 G9 `1 ~ alert("重复密码与登陆密码不相同");
1 o& h J0 U# j& ?' f& f D% E document.sform1.password.focus(); % R! i. a1 X9 O+ N7 a5 ~
document.sform1.password1.focus();
: [5 r; ~# Z2 M; t2 P; f* ^6 { return false;
|5 _8 |. ?6 F) B6 O3 x' n, k }
" ?5 L3 J% Q3 \4 O- f! F: l if (document.sform1.email.value == "")
/ e+ i1 q& d; A { 8 l% D$ R4 g# H# _. K @: O- ]0 q
alert("请输入您的E-MAIL地址");
; @$ g6 w; }1 ?$ M0 f" h document.sform1.email.focus(); : [ ^" D2 Y+ A7 ~1 F, r9 v" i4 Y% ~
return false; ' V* v+ ?' P7 L
}
, G+ N5 s6 J6 i/ \3 O
' y4 o$ k. R" q7 `/ {6 @2 W) U email=document.sform1.email.value; 9 x& L; w: l; k" h; v. w
emailerr=0 / X5 ?) \. ?! m4 I/ D% }
for (i=0; i<email.length; i++)
& y. w# ^$ C% C- C. i2 F3 G( W: H { $ l# _& N; o) M+ D7 G Q
if ((email.charAt(i) == "@") & (email.length > 5))
4 e) h [. z7 D {
! j& d% O# u1 v' ?+ R emailerr=emailerr+1
8 q/ {* d- p4 e8 c1 a/ P/ { } : U# g; X$ R- s. B5 T! d) o ]
}
) u+ R, ^6 k3 t* ~2 P5 o if (emailerr != 1) . S1 G M9 i' X( j& R
{ 4 r4 j( L" j5 `, }
alert("请输入正确的E-MAIL地址");
g/ h! w9 r8 F" R: l- v document.sform1.email.focus(); 5 g/ n% N8 U. {
return false; ( a3 X* N& ]. F6 }% K5 L* W0 ]* F
}
7 @3 s1 I. n3 M
/ l" q" ]! ^/ c1 J; a- R if (document.sform1.checkask.value=="") % s4 ^8 j. s/ d9 ]+ ~3 `# s
{
7 ]& A$ y" }& m8 A% F alert("密码提示问题不能为空");
" P' H" o# B3 E, ^ document.sform1.checkask.focus();
# t! u" K1 m' O/ a N% |& C return false; $ I) D4 }5 ` `8 A
} ! @. |$ w% t% Z' A, f- B
if (document.sform1.checkans.value=="")
4 I5 d+ c" Y2 {$ |7 P {
+ A& I3 [- u. G6 S, F- |7 L alert("您的密码提示问题答案不能为空");
9 X& c, W) T/ i; U document.sform1.checkans.focus(); 7 K& M3 R* c& u2 B _! f/ y0 Z
return false;
4 f- X5 k S- L: F3 s2 f/ @1 M7 A }: I. g3 t" M. k9 h3 |5 P9 \
return true;
8 F6 W, e* |! _, Z : p1 k; }- z0 ^$ g& n9 N- _7 e8 R* D
}
$ M/ r6 V' t& L! R& k- L$ M/ N</script> |
|