|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14331
- 金币
- 2451
- 威望
- 1647
- 贡献
- 1399
|
这个脚本对你可能有帮助:5 @- R8 j7 |8 s4 a# w$ b
<script language="javascript">
) F. @+ Q0 H5 ffunction IsDigit(cCheck)
5 L3 R# R1 |" T& z6 S; D6 q3 ~ {
1 R# s! _, d# @3 S5 ?- i return (('0'<=cCheck) && (cCheck<='9'));
- {) Q$ o8 N w6 z$ y; ?2 h9 W$ Z }
5 a! _, [; l& [% W2 v
7 r. \6 F# D* x) F8 Cfunction IsAlpha(cCheck)
. b/ d, `) u. f8 q7 b8 } { O3 S3 b4 y! Q
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
8 d) ]& n( Z4 p: V7 W% |# d8 o) E } - q' [, n. l4 {4 O3 W
( V' R2 O f; u6 D8 o
function IsaNull(cCheck) ; w! [- n) {# S1 P: i. S
{
2 E% r0 K' w) b8 E `! w return(cCheck != " ")
3 ^2 _5 v& x1 Y! u2 Q } 5 l6 P6 q0 }: s: ]- N) {* t! T
! d$ Y+ O! ?% B$ @6 D
function checkform() . L& e( e6 X' {6 Z# n
{ 9 m. h0 V& v/ h5 N
id = document.sform1.id.value;
& U8 t( i" S+ V* }: e' ^ if (id == "")
& e1 v) C8 {/ @2 a+ D {
3 ` N6 A1 X; v! \5 c alert("请输入注册名");
: @1 `: o9 N. A% P% s1 @( d document.sform1.id.focus(); ! V. L% d" `' r, F( s
return false; ( F0 |4 Q& r. a: M- f% [
}
) h" z, Z P- }; L. Z , ~6 n9 n" V5 o0 B/ C- c
for (nIndex=0; nIndex<id.length; nIndex++)
F$ q5 y' D, L# Z { - {0 K! r: }- v
cCheck = id.charAt(nIndex);
1 R& z, {- k+ b1 [! Y if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) , C; ^6 |2 X- R
{ 3 I: v8 E8 B7 g& W! s1 A6 M2 j @. z% m
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
! O! U$ v6 F+ O document.sform1.id.focus(); $ q+ W b! D3 \8 x8 g* H; A
return false; " m/ f6 ~( y+ [, o8 O+ ?' q
}
3 O$ Q/ y o0 |0 G1 Q } % s% K4 U `, y3 f% X7 Y' o; n
chineseid = document.sform1.chineseid.value;
: B6 W+ G- M4 D) h8 Y" k; ^9 \ if (chineseid == "") ; @1 E- B0 k; w K7 H
{ ' S! ~2 [ {5 k& s
alert("请输入中文昵称"); 1 C) l; s6 J8 |# ^, h3 @( k
document.sform1.chineseid.focus();
, b6 ?( @+ f5 n4 Y2 T/ _ return false; 2 H& X2 u5 Y8 g* ~
} ?- b0 [5 j/ R# x4 u
password = document.sform1.password.value; ! T: o" @3 c+ q: ^3 ` J9 I
if (password == "") ; }+ |# v0 z7 S, j" \( K
{
, p2 A9 S0 Z* g0 c alert("请输入登陆密码");
& T' [ O: E: W8 Y% @- R document.sform1.password.focus(); ( ]$ v0 Z3 s* o4 M
return false; 5 r/ [" O; [4 S- a. g- S
}
4 k0 \* _% X9 `' \ password1 = document.sform1.password1.value;
1 c M T: g+ x& W) ~* F if (password>password1) ; T4 n( e; ^% ?6 k6 ?3 f
{ `& a) Y, M% S, Q2 [/ o
alert("重复密码与登陆密码不相同"); , N! w) y& h G( R" i0 V
document.sform1.password.focus(); ' s; O9 n' I; F
document.sform1.password1.focus();
% a3 v" B9 S, k5 L# j/ w* R return false;/ B) i8 L* w7 s6 V. G
} % b3 }" C' Y3 o. I' M6 G
if (password<password1) & x7 n/ H( N9 c; T
{6 f* H1 N. @: H7 D! H1 x u
alert("重复密码与登陆密码不相同"); # C5 ?0 [& X. F- g/ m' [/ O: H
document.sform1.password.focus(); 8 N6 g4 ^3 ^4 {5 `; ~# J
document.sform1.password1.focus(); 3 z, Y. T3 I4 b( h
return false;
( F# o) t" F B4 `5 L' X }
. [' h2 S, R1 q+ ]% u if (document.sform1.email.value == "")
, g# i( c) G3 Y0 z& m { / A, ~. d( f; ^6 C* m0 k# n- Y
alert("请输入您的E-MAIL地址"); 7 B+ m0 ^6 Q+ N& x
document.sform1.email.focus(); 4 ~% F& n% F2 j$ M& V% U+ w+ b
return false;
* K& K$ u3 F3 h+ o( F# A& O. I }
( v$ |" c! ~9 q' d) b5 u & r2 s/ N, W$ J) e$ K. @5 ^2 T4 |1 W
email=document.sform1.email.value; . L/ @! I( i4 T5 j+ _
emailerr=0
G8 C- v: a* c$ y! J: u for (i=0; i<email.length; i++) # L+ i5 Z( P3 ]. }7 Z5 c d* H
{
: Q6 |1 E- b* W" B$ R if ((email.charAt(i) == "@") & (email.length > 5))
; _* H) P( x( V {
, ^! X2 H0 p% f# |# w$ a8 p emailerr=emailerr+1 + }" s+ I, ~* F
} & v+ A' m+ x% a1 Q" Q6 ^
}
/ a3 }: L6 M) H) |; ~. o* E if (emailerr != 1) 2 L4 v( O; b, \0 t3 D: D/ k/ ?5 u
{ , H2 x9 c, ~) J1 J) I2 P
alert("请输入正确的E-MAIL地址");
- p6 F ` Z E document.sform1.email.focus(); ; N1 @$ A: V( d* `2 ~+ q
return false;
+ p% K y4 y: _) P+ K. k; z, [8 h }
4 l3 [. ~# Y2 H9 K7 t8 o# Y+ G& ^; j) z
% N5 r' {+ t+ G) |+ Y: X; l+ q9 J if (document.sform1.checkask.value=="")
W9 { Y& g% X ?4 Q {
, a% Q1 x( f' M( y! p alert("密码提示问题不能为空"); * u* C) k% L( \
document.sform1.checkask.focus(); . f# |! Z3 O i i7 j( D
return false;
% G& V8 P2 F+ v7 H* j4 E }
! j) S8 X6 Y1 g) x$ E: ~ if (document.sform1.checkans.value=="")
0 Q. S1 g* f% j& ~4 D! U- ` {
8 [( n* g. R- |# j" ^0 B6 D alert("您的密码提示问题答案不能为空");
% ~1 A, ^7 i8 b0 e+ B6 x) b0 U document.sform1.checkans.focus();
' t7 N& k) I2 f: b return false; : b5 y( R! `0 {, d# \
}
( x _: A5 K" x/ P( R& Q1 Q return true;
0 _. ~# m( `( \5 i* S; ]7 L1 n 6 ^9 r3 U8 e. [9 P" L
}
) Y; \0 F( n# |$ n</script> |
|