|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助: M# U+ B# Z. u' f: d
<script language="javascript">
* I! Y! @2 x. v5 Afunction IsDigit(cCheck) 8 N s' s9 y4 ?% c0 s& K
{
& Z h4 O5 c4 W- X5 Z return (('0'<=cCheck) && (cCheck<='9')); 9 Q0 y% n( N0 W; C- M3 f- I
}
& S2 ?6 u1 r6 R9 p1 m& h
2 b6 Z$ Y+ e( B8 ]function IsAlpha(cCheck) , F* q7 h) g: Y) C: z2 L6 F/ W
{ $ ]$ P7 z- ^% t% _3 _4 c5 F
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
- O$ c( i" H0 o, U8 D& P) @. i }
0 `) x3 E' K1 b
3 ?+ c+ M4 O$ Dfunction IsaNull(cCheck) + D/ E$ o& V+ h! |/ D# C! _& a
{
: ]5 |8 G* M7 K2 Q& @7 C return(cCheck != " ")
: j! I) S8 A9 t) f5 J" K+ z) n }
6 D4 m& p3 J4 e. \- A0 A " a3 B# R( C g
function checkform()
% w. a( V" O1 p( I; N- p/ i{
; ^# l: G ?' M E) e- l( V id = document.sform1.id.value; 9 P( |1 _% ~* ?" g- L N! q
if (id == "") 8 u% c( Z1 A5 z9 n. L
{ ' ?3 y' a! o$ w! M( k2 f6 F
alert("请输入注册名");
& u; |1 y5 n2 X$ f8 k! ` document.sform1.id.focus();
+ d) _7 ~2 ^6 I/ h# T5 T, Z3 M return false;
, e2 o7 [) A: c } 0 _! d; @3 R% K) `8 y7 V
. G9 ~! v$ Q$ K5 i7 R4 s for (nIndex=0; nIndex<id.length; nIndex++)
~1 F, W. u6 @* w% a6 e2 Y& x4 I* o {
* ~0 _) \2 i3 y+ f cCheck = id.charAt(nIndex); / t7 K* e9 x$ l; ?) I
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
- c* \* _5 m( A3 p# o { + Y3 D. g2 k |& [. X
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 3 j0 X( _# M8 P
document.sform1.id.focus();
8 _( l1 X9 `' J return false;
0 V7 L, K7 a, L: q0 e7 t0 { }
* w5 P7 s+ ~) P, b) A }
4 ~4 |5 p# o' c- r1 J X chineseid = document.sform1.chineseid.value; 1 Y2 X% [3 X) @) h, ?
if (chineseid == "")
. L- b& m6 J8 N) z: z3 j7 q1 b: d { 4 i7 M& o7 J' B1 J! o
alert("请输入中文昵称");
) }5 j, z& I4 y! w& ]: w% q document.sform1.chineseid.focus();
, y u6 t5 J2 p8 c return false;
5 r$ p6 I2 @- ~4 ? }
( y+ J7 U9 G, Q- N/ h; c password = document.sform1.password.value; 1 B- P) _/ N% P+ T: n. G$ B
if (password == "")
% l9 H7 s# o8 o! @0 k7 f { ' S/ g# ]" }5 D% J
alert("请输入登陆密码"); ! K. v3 y8 R% I" c2 V
document.sform1.password.focus(); . h0 o* k' `) W; g) L
return false; ( ~1 I7 j4 |1 i9 r9 _& ^5 F# e
} 2 ^( H. ?+ J6 K5 `+ O7 A
password1 = document.sform1.password1.value; 5 j3 |; H: L1 y
if (password>password1)
: X" J! b8 |0 o% R {
0 B/ w1 Z( u" \' f) V- U" z alert("重复密码与登陆密码不相同");
c/ _* C% O: \$ h document.sform1.password.focus();
9 U8 Q' j0 O, [2 e; t document.sform1.password1.focus();
3 ^+ l2 c. {8 u% T- F return false;
& f3 i- S% ]# L, u3 [4 k3 | } # Y: l4 s1 Q2 ~
if (password<password1) 1 P0 n7 f! G; A( p0 I3 s8 J1 o
{# l0 G* ~; K9 w3 B* v8 e
alert("重复密码与登陆密码不相同");
: s7 n2 }6 V* W0 ]& z- u document.sform1.password.focus();
, [; r- f6 i, b document.sform1.password1.focus(); - g5 w. l2 U8 b
return false;' U: o- _/ H& k* W, O
}
8 l7 Z/ _2 H, i" D" z if (document.sform1.email.value == "") $ B1 O2 ]& b. D
{
' v" m* D3 b l* i( A alert("请输入您的E-MAIL地址");
& J" I& k4 s/ d! B8 A document.sform1.email.focus();
+ R. [; k2 W% O( ?! k( \+ z return false;
: q# D* ~7 y$ I' b8 y3 K }
+ p5 `) z$ M$ Y% P
9 B0 B5 O3 M. K email=document.sform1.email.value;
1 J: u' S! a2 M& x! Q2 @ emailerr=0
9 u, h8 p0 V$ |! L* r# _! t- t for (i=0; i<email.length; i++) % d$ D" o7 m) W q) m; l
{ 6 F- w1 _. P# ~+ M# _, x1 I/ t" I
if ((email.charAt(i) == "@") & (email.length > 5))
) M: m, W& i4 X y0 x5 i i {
$ s. u0 @9 a: [4 p0 I9 o& B) J emailerr=emailerr+1
. J0 U, O' P# J8 ^ } % U) U( }) e: y
}
8 k D8 w5 g7 R! {( n; H if (emailerr != 1) 9 t T& x. q* U8 v+ F! U2 ?
{ - C4 l8 O: ]6 A) @
alert("请输入正确的E-MAIL地址"); # k. j/ W, Z$ h! ]- @4 \( A R
document.sform1.email.focus(); & g& x8 M, i( H0 r* }
return false; 7 I0 y2 k/ _3 q* x, b
}
. b) U: T8 f% N3 x8 b9 U
4 A l; z% b1 y3 v H if (document.sform1.checkask.value=="")
7 U- s7 z% _+ h9 c( p8 G {
' n. B# M4 q2 P8 t# \5 e) b alert("密码提示问题不能为空");
, L- A1 x4 R; I6 F# {" @ document.sform1.checkask.focus();
- L" I3 q/ T' A. I6 j: J return false; % ?" v" j: E9 Z {& T$ Q
}
! | Q" p F9 C+ d* Q& n if (document.sform1.checkans.value=="")
6 }: A5 g4 H# \2 g* a- I9 D' u7 E { 5 X- ]( q1 j5 |: e
alert("您的密码提示问题答案不能为空"); 7 x( q6 m9 @4 r* [
document.sform1.checkans.focus(); , A% @: M2 m6 n
return false; 2 ^; W8 d n9 |- [( ]
}5 {; H9 ~! S5 m3 q
return true;
' F' o' b# ?1 j3 t 7 Y: \% M! f& P/ y/ `# N! ~% ]7 Z
}
( M# X2 [2 Q- o6 ?4 R6 Z</script> |
|