|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:. K7 F2 R `3 _' q- F& G0 D' w
<script language="javascript"> " V% f4 Q, H" u* h
function IsDigit(cCheck) 7 U! S! p3 O6 [: ~( I, w
{
8 ?3 m; ?/ L! M. ~- Y. \ return (('0'<=cCheck) && (cCheck<='9')); 0 _4 T9 m: }8 j! T/ p
}
# m9 u8 Y) ~' v5 `
: o$ Y ~' ?' R' L& X6 @# H- Xfunction IsAlpha(cCheck)
: J+ s& t% O. v. I9 b {
8 w/ K' I4 I7 j6 U+ z ^ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% B% r4 }( X5 Z- |( C1 f6 Y+ i } & m" u* t& _1 g% |4 F
0 U8 e3 H0 t" v! i+ y9 W) B
function IsaNull(cCheck) * t7 Y( X! A/ |! s N6 ~
{ 3 \) ^* I) P- l: f
return(cCheck != " ") ' C, P4 p( c' Z2 P) y
} n+ ], r9 N4 L
7 l. p& p) f7 p4 |7 l
function checkform() B6 `# B) B/ k. M% D; N
{
& A1 ], n2 C2 b( C id = document.sform1.id.value;
; G- S8 \+ N/ ] if (id == "") : }+ ]- v8 O8 m1 A
{
) ]4 D7 f. a j alert("请输入注册名"); 7 {( p Q) \; F+ P
document.sform1.id.focus();
5 p& ]0 A/ V% k+ C, V return false; ) j. l8 h) K9 K7 K0 \! Z/ u, z
} . H2 W: i" J; k2 [2 n! D
' w# t5 Y A n4 f" f
for (nIndex=0; nIndex<id.length; nIndex++) 0 A' _( X( B0 N
{ 7 i- Q& C% l8 Y1 w
cCheck = id.charAt(nIndex); 6 h' Y1 d- Q$ {
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! s8 [9 p" h, P9 i! ?
{ 3 f+ K! a4 k# B
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
" z/ g( f- W- O! k9 m- M" J. D( `; } document.sform1.id.focus(); , |/ V, w: V/ N, L* o: I
return false; ! M) w+ U: {2 }# o3 c8 ~2 j
} 1 ~3 W$ L7 r0 h+ W( \5 s
} 8 B6 b1 F# V3 _. Y3 g, c. Y) R% M
chineseid = document.sform1.chineseid.value;
8 D6 ~$ L9 o/ i% P if (chineseid == "")
: T' c" ~* s; w5 r/ D4 f5 g { ) b: f( s. D) U9 x' W
alert("请输入中文昵称"); ) w8 W5 j2 N1 y# Q) M3 g- B% C4 N
document.sform1.chineseid.focus();
+ n2 {5 W( C; F) H- L return false; % X' A7 Z' F* W2 Q& [0 Z
}
% z: r& |. U# v- k6 g/ y; Y password = document.sform1.password.value;
7 R: {0 X X! a7 Z if (password == "") % o' L5 R1 A# _4 p2 i7 m$ L
{
# z0 h" U8 B% e7 P" ~2 G alert("请输入登陆密码");
; w+ o6 [- P2 [% |. b document.sform1.password.focus();
4 r. b/ ^7 [$ Q. d5 s+ o3 m l$ N return false; + ?7 P& P/ C! q" X9 m& W6 r- B, e- E
} % F$ P R; Q* z
password1 = document.sform1.password1.value;
! q7 k. U: z, u- p if (password>password1) * d* r" J/ @3 w% {
{
. U* ^6 p- ~7 K4 _! L0 s( t" w# m alert("重复密码与登陆密码不相同");
# V9 B- P' u( |5 I! m document.sform1.password.focus();
7 n) S3 y. l( f' F n+ S1 Y/ Y document.sform1.password1.focus();
f1 y6 a9 c# e: `- `, ~3 }3 ^) N return false;; U8 H+ f; [4 L4 e8 `1 A
} 9 d! y( u& n7 _4 w5 E! c- T
if (password<password1)
* S) N; g- ]5 }7 C6 p {- w5 L; Q, s' P( C- V/ e
alert("重复密码与登陆密码不相同");
; q9 {- w5 n9 v. G document.sform1.password.focus();
4 x% Q" v! n3 W* s# b document.sform1.password1.focus(); , M7 V& N" j6 g( K4 O
return false;; ?, Z' H6 _$ o4 t3 Y8 a# s
} 6 |5 G F; y4 T( r" N3 c+ D% m
if (document.sform1.email.value == "")
5 n7 `* E8 i+ P7 n; Y! b; `9 g/ x { + k! _# @$ ~/ Q* t4 E
alert("请输入您的E-MAIL地址"); ( ?, O' ?" G" ^9 K0 C
document.sform1.email.focus();
8 l/ S# j4 F% ? return false; ( r3 F9 v4 n2 c6 d7 G
}
. B4 ~# |+ T2 i3 R, a
& A" p4 J* ?) R) a5 P; z7 V' W email=document.sform1.email.value;
& @( G: R3 l" H t2 T& i' i emailerr=0 + n0 W1 ^+ i) k" n a. D. X
for (i=0; i<email.length; i++) 8 a7 u/ G+ `$ C l2 y3 |7 h
{ $ y1 |4 N7 r. W2 [6 ]" I) w
if ((email.charAt(i) == "@") & (email.length > 5))
* ?* K; l' j! A0 M; j9 x$ x { : W$ P* t! z* P) e4 D
emailerr=emailerr+1 & ~* _& |3 Z! N. ^1 _
}
& b; K4 H" e% Q/ E5 W/ K6 A( Y9 Z } 3 L$ Z9 ]2 ^% ^* K! c, z% p; O
if (emailerr != 1) 5 j0 O" r v( K+ ~ {6 W: r- p
{
9 W' Y- N( Z4 Q* J2 i* ? alert("请输入正确的E-MAIL地址"); ' G2 D2 ^6 \1 E, r6 k. A, D* d
document.sform1.email.focus();
6 m( b( c/ y; d3 {& x. ~ return false;
2 A$ w: B. C$ }6 H# ] } 6 R" r) D- K! o8 ^" H$ V
; P" T* ]0 I( c U$ A0 C/ \ if (document.sform1.checkask.value=="") - [. s. o+ E% L+ v9 c5 w
{ 9 J* Z" ^7 B; o; e6 X
alert("密码提示问题不能为空"); ' {7 x. S- }2 X" m/ O
document.sform1.checkask.focus();
4 J7 D- t3 T4 I return false; _0 [: X- f+ x. \2 ]& X* q
}
1 t2 O6 C+ O/ ?! n: c7 M" c if (document.sform1.checkans.value=="") 6 A" z, T; G8 ~9 P1 {3 U
{
) G& K/ {+ j" C2 O# R alert("您的密码提示问题答案不能为空");
: \+ ]1 Z: y4 \& ~6 W( S7 b document.sform1.checkans.focus(); . f1 C) c) _% G+ b' ?0 c
return false; 7 a8 J+ W6 R" h
}
$ M% ]* e( J7 {% `1 v: f return true;
a4 S, m: }+ q* F! Z9 ~ 0 m: Y- v. i9 w. R
}
$ S* S1 l+ i: }4 c/ d# t</script> |
|