|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14413
- 金币
- 2492
- 威望
- 1647
- 贡献
- 1440
|
这个脚本对你可能有帮助:
8 n4 I( H0 F4 R3 ]! L. n<script language="javascript"> ' Q2 i0 z) t6 p& ^) {+ l
function IsDigit(cCheck) . g4 j y5 f: _) O8 @0 J; Y& j
{ 3 Y& g' M+ H( o2 t* G% z L9 }- U0 M
return (('0'<=cCheck) && (cCheck<='9'));
6 v2 S& w- k( a } : G$ x$ N' K7 L7 g9 M# W! z
+ m. z" f$ X. `& e7 r6 B- G, Xfunction IsAlpha(cCheck)
" W& }0 y* j3 V, C: |8 I { 1 C1 j; e/ I3 [7 y( E
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) : M! H" q% c, q/ I7 s2 Y' p
} ) r, t$ I5 B+ F$ ^
" m+ _' Z+ b9 j) ^" m
function IsaNull(cCheck) $ X. w Q7 ~, h6 p7 A
{ 9 @: Z ?3 y/ R7 n5 J) M
return(cCheck != " ") , f; `2 k" l! z; R1 n
}
5 D" v7 l$ T+ b
6 f9 ]/ C5 u% j6 c) ?: c9 gfunction checkform()
) {+ h* z+ |4 P6 f/ R) K/ \- s{ 5 k) w& a- R9 B; O6 k
id = document.sform1.id.value;
J# x6 r \# @) N# L) b if (id == "")
5 Y$ q2 f/ g5 C+ ~, y' [3 P { 1 B& C7 }0 Y) g; O2 G; b
alert("请输入注册名");
2 A$ J, ^' @0 R5 p: W# f4 V document.sform1.id.focus(); - d# t( O3 t, g; F6 b W0 Z
return false;
7 }# V' p" j% F# D K8 }& T4 O }
, C$ z4 l$ g6 j# i, f
& n1 y; R' U6 i! I: R for (nIndex=0; nIndex<id.length; nIndex++)
! V# B4 A0 I+ I0 R9 t* M" S { 9 K& ^0 @8 A. H: h' G" ^+ {
cCheck = id.charAt(nIndex);
7 `1 G7 f4 e/ { if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
; }: H. d: [, u4 I {
6 z8 k2 M9 e* P- b& w# v alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 2 y6 L/ c% Y$ K7 A$ I$ i* N8 l
document.sform1.id.focus();
9 _+ z) V# i# r" ?3 V- N! R return false; # x( S! ]+ @2 ~4 g# ^# {
} ! F: @9 {8 o8 t7 e
} . ]1 ~: m# I, d
chineseid = document.sform1.chineseid.value; ; |/ v+ V# X& A: v* c
if (chineseid == "")
( [$ u) h) P% R! i: V' X0 M7 f { ! K* @( s, f* U% X
alert("请输入中文昵称");
) W+ \" G' v! h: ?7 Y document.sform1.chineseid.focus();
1 `" L/ _0 u* _; R return false;
9 h/ v* z' l. Z- g: {( U }
- n8 T. T8 \! p O- X" I password = document.sform1.password.value; ^. p9 d1 {7 C2 H; Y7 i' h
if (password == "") . Z# h. _; R; v4 C2 I
{ # W% E* i- e7 Q+ R$ [/ ~
alert("请输入登陆密码");
J$ b. [# K4 f2 Z) O: D document.sform1.password.focus();
! ^/ e5 C5 e% `) G8 }$ l5 M return false;
y* E- l3 P* x, @, Q2 N( M3 ] }
' D2 N r g' I' ]6 a password1 = document.sform1.password1.value;
6 I6 ^2 n3 m$ X& [) E" r if (password>password1)
% C0 s3 H T* G/ s: q" ] {
! N1 w$ O3 T; y+ P" \! L5 M alert("重复密码与登陆密码不相同"); 0 a v( q: y( Q' I: A
document.sform1.password.focus(); ! ^; Y" @" Q( _& `
document.sform1.password1.focus(); 4 {/ q3 t. D4 D3 n, }0 I
return false;
( ~: Q/ n$ D3 N( y3 X1 r% Y3 R6 ^ } - T& Z' D" |* U3 _# w+ G
if (password<password1) 4 k4 E9 I6 F1 k% H
{5 N0 Z6 U$ R* ?$ L: ]/ X8 t5 ]: y
alert("重复密码与登陆密码不相同"); ( g4 m s' W. z; Y) W! U+ I
document.sform1.password.focus(); 0 E* T/ L5 g* K
document.sform1.password1.focus();
! T" I7 M/ A! K& [2 n- w return false;
5 T. ]; p+ `$ i- K# D. z } 3 h5 F1 I& c' x6 }( G7 n# a0 `; J
if (document.sform1.email.value == "")
, Z s; }5 s# i7 \5 J2 P7 @ {
9 a2 a# g- _) i& z i5 m X# Q alert("请输入您的E-MAIL地址"); 2 v+ m7 a8 P* [) @/ I" v: L
document.sform1.email.focus(); 4 ?3 W) u; m* P
return false; ) ^2 a' T2 f/ ?2 p7 _) ^- H
} 0 y/ _1 W4 R$ F1 y$ u9 S: Z& P
' F$ ~0 c) K9 w
email=document.sform1.email.value;
& @& H6 i4 @$ m0 x emailerr=0 - v, j. u$ B) u
for (i=0; i<email.length; i++) 4 O+ f+ l& m. d6 O# T
{ ! _/ R" Z! L |- w6 T
if ((email.charAt(i) == "@") & (email.length > 5))
8 V$ c) P4 \% F) k' k u2 { { * r3 k @1 x- c
emailerr=emailerr+1
: M4 L; U# Z# P* f& Q& a6 N/ \, y5 ] }
6 }! N3 |" x; F# f+ G2 R }
- b# t4 O9 } [( U2 o$ } if (emailerr != 1) 2 R+ p& _ S) ~
{
0 P9 [) O ^; d alert("请输入正确的E-MAIL地址"); ( N' U$ a+ X5 A5 R# [, g
document.sform1.email.focus(); 0 {; |( Q9 X3 y2 D4 Z: {
return false; 6 L( r* W8 \/ t6 |4 M0 S
} 9 C; h w8 r d# I( c8 p- Y
4 {; Q, P( B6 P& _7 ]
if (document.sform1.checkask.value=="")
& O' s# s2 @) a6 e( j- W { ! ^. z9 u5 X6 h9 ?) T% t
alert("密码提示问题不能为空");
9 T$ K0 J A$ J- a, q% U, ? document.sform1.checkask.focus();
( w' o- T- x' w; ~ return false; ) a& u( Z' w- `9 F, ?" d) ?$ z
}
8 V" v9 L4 ], j if (document.sform1.checkans.value=="")
0 y0 D& @8 ]0 R* U- o* E% R { \% m: J4 g8 d: Q3 N3 x/ X4 ~
alert("您的密码提示问题答案不能为空"); % H3 i v9 Y, e- q/ |; ?9 ? ~; f! l
document.sform1.checkans.focus(); 6 x5 T( t0 U2 d, _2 p; z4 V# g
return false; 7 p' G$ B+ m. b. z+ c$ X
}" A; t ~% [/ Y: D
return true;
' S2 n# R+ O- v. x4 |
- L- S6 z* O! L}
% x& @- C1 g# @! J</script> |
|