|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14417
- 金币
- 2494
- 威望
- 1647
- 贡献
- 1442
|
这个脚本对你可能有帮助: E/ S0 h4 _% S2 {! J
<script language="javascript">
' P. ]$ Z5 z2 T8 T/ C7 G* m! Tfunction IsDigit(cCheck) v6 p0 @! O& G J# v/ C1 m
{
8 S& K; T) u5 L3 G* x6 ]3 f$ Y" u return (('0'<=cCheck) && (cCheck<='9'));
- x3 _: ~3 H, ~8 d9 g! g }
/ B) P I* e& D' \/ T9 U5 u1 l ) d4 V- o- Z: f6 `) e- y+ d/ ^6 z
function IsAlpha(cCheck)
) Q& `5 [7 A8 x( N' M { * g+ ]9 h1 g4 ?4 V3 ~! j
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 j Q0 z3 j7 o& e
} 2 C: e8 r a6 T2 `8 B1 }) r; G# }
* e( v! j$ R* F$ Y* o
function IsaNull(cCheck) 1 V0 |& m. M) O$ o" R6 k! L
{
, C. Z, f8 H5 } return(cCheck != " ")
/ u3 w9 ?& w6 |) N }
/ `# G+ X3 \- d: r6 Y+ ^- e; X
! W: s# s y+ C& J3 C- O; vfunction checkform()
0 { n4 |8 M4 k6 G2 c{
; i/ o4 ^) s1 B3 e* `$ q id = document.sform1.id.value; ! F A; y% x* H4 a8 e
if (id == "")
. }" }. Y/ V, x" B0 S; ]& J0 N { ) }4 `5 n, L c. h) X9 `
alert("请输入注册名");
% u& L" O* a9 C; _ document.sform1.id.focus();
/ U9 l$ A" S1 l return false; # s6 S8 u, Y8 e/ K- G3 f! U+ p V
}
2 F, B+ \2 p G6 s/ v
( L( M7 [1 N/ Y h for (nIndex=0; nIndex<id.length; nIndex++)
" {2 y6 e2 X. P* E+ u8 l9 T { 7 [; g5 @$ L+ ` n. v( N- G9 o; S
cCheck = id.charAt(nIndex);
4 J- q$ G. _, o+ P/ t1 V7 j if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 4 q1 s" \' A6 a: @6 ?7 C- A: P2 \
{ / ^% f9 L& _1 `% i. g
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' @4 N6 }5 z2 @& j* d2 ~1 t# x5 v
document.sform1.id.focus();
. P7 ^$ h% f. o0 ] return false;
7 F0 f% H$ {6 D1 S, F }
$ @; e/ {+ `5 ]. o } # a" M" I! T7 H6 h! s: P
chineseid = document.sform1.chineseid.value;
* K" K( o( H; e if (chineseid == "") 1 u9 t1 F2 Z; ~& L
{
0 D! y6 r# p. k8 E9 J alert("请输入中文昵称"); 7 e* t- u2 R3 I6 e
document.sform1.chineseid.focus();
" v5 d. ?$ u% z. Y% @. ]6 P return false;
' F# E f; K& D4 h7 X b+ H7 P }
1 {# ^& s3 X/ H( G password = document.sform1.password.value; 9 W& a Z/ N$ Q2 V
if (password == "")
E& o8 s" B1 i" \, Y2 S {
- ?0 i; L& B: ]4 W3 \7 z3 l& K alert("请输入登陆密码");
& f* ^" W( n8 w" q, W6 K document.sform1.password.focus();
! ]2 m) T4 f5 `& a. a6 R return false; ! A$ L$ K: i" g2 j
} $ ^& M7 z# G. |( H9 F5 T
password1 = document.sform1.password1.value;
' |9 F! @! g: P8 R( W if (password>password1)
0 U5 t0 o B' Z {8 J. J7 F; I; M- u- t! _& Z% Q7 Z4 p
alert("重复密码与登陆密码不相同"); 0 k0 Q3 V2 g# Y2 ~% r" s% m
document.sform1.password.focus(); ' b2 |+ z* m) _; h+ { F
document.sform1.password1.focus(); + F/ a# i) `7 V# C# S' J4 I, z
return false;
1 g. X$ [9 D( C* x7 g" A } - r# ?7 {1 t# j6 G% |2 n& N1 b
if (password<password1)
- w2 m4 Z; e" A, f9 y a x! Y7 Y {6 L, Z- n7 W1 J) K$ O( X' D
alert("重复密码与登陆密码不相同");
: V m b t* i document.sform1.password.focus(); " s" _+ B3 U5 ]6 s# B1 Q0 p( S
document.sform1.password1.focus();
9 I! ^3 g1 g2 g return false;
" d# y. b. ?$ I' B3 g8 R; } }
! Q3 ^2 u+ L% j4 f/ g ~" @3 H if (document.sform1.email.value == "") % u4 o: \3 ]! s+ K0 r/ P- ^
{
$ m D* b: Z' v alert("请输入您的E-MAIL地址");
, _' p$ M q9 Q) R1 D- O4 M document.sform1.email.focus(); ! @# p7 A' F1 F4 p$ `* l9 o# N1 R
return false;
" D. T! L t: p# i$ l9 X$ P }
( X- `( m7 c, j* A2 F
, F* X; {( }8 Q( a9 V email=document.sform1.email.value; * u% C' t" M) b
emailerr=0
, P; {7 M" E# ] for (i=0; i<email.length; i++) / d% \9 S. D7 D0 O ]
{
& H2 `: u. E" L1 S6 ^9 [( A6 O% a if ((email.charAt(i) == "@") & (email.length > 5))
) E, I! N y, `- }* d; A& a {
9 ?3 D, A5 V1 q/ a# o6 G emailerr=emailerr+1
* [+ O: ` ?: X* Z8 a. g$ I9 a- V }
, x( u9 _/ M7 h1 P% s* V }
$ ^& B4 C- F# r; D: l, }: \% k5 H if (emailerr != 1) & @$ M$ g0 d# o4 ]2 ]
{ / ^; E1 r* y% C. j. Q2 b/ {
alert("请输入正确的E-MAIL地址");
; U9 [, K, A7 i' S; ^ document.sform1.email.focus(); - Y7 l! N3 d6 M! c' }8 y* I
return false;
; G$ A6 d$ B" V/ G' u6 I* } }
: D- N1 d5 W- B7 i 6 m0 L# H" n1 K9 G0 H( u/ z
if (document.sform1.checkask.value=="") : |; u) V0 [9 y# G
{
4 Z, x, b8 p& _' P' Y5 o alert("密码提示问题不能为空");
5 }) U. x2 m# Z4 u7 z1 k: q1 m document.sform1.checkask.focus();
2 h2 A$ K7 s, w" b' S" K return false;
. ~; P% n7 V& _0 ? }
- u; Y0 P% a R" N3 u9 V0 {" @ if (document.sform1.checkans.value=="")
3 S! ?$ ?: @8 R" n+ g {
; u+ Q2 R6 b" v3 S* b+ p alert("您的密码提示问题答案不能为空");
5 m8 Z% y; `9 e# R- Y ]" F) L7 D document.sform1.checkans.focus(); 6 q2 O2 O9 l& G5 Q0 z$ f
return false;
0 {' q L5 H* E) Q y% ?1 i: b* V+ K }
6 b9 E2 O( v$ G' X+ }" Y% l' @ return true;
8 H! O6 ^+ t/ g) E5 J
0 B) b, x2 x* h}
* s& U6 m6 o: `6 X- C E9 G$ `</script> |
|