|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14411
- 金币
- 2491
- 威望
- 1647
- 贡献
- 1439
|
这个脚本对你可能有帮助:4 p j1 ^" m! ^ k; g4 P& m
<script language="javascript">
0 X6 P% Y% Q' w& pfunction IsDigit(cCheck)
$ c5 N4 b8 w B& M5 ~+ |& e {
: D: y7 N* _1 {' ]* n; T6 ]3 [ return (('0'<=cCheck) && (cCheck<='9'));
* g( ]1 A! i' E( t5 O. D }
1 I3 Q# S% l% J6 ]6 K- P & G, p. ~! B' Y- F$ v, Y! m
function IsAlpha(cCheck) 9 Y+ {. O) K. U
{ - D9 Z$ k" X) r: o1 Z
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ' S% h# G+ x, {7 Q! D- ^" h* i
} , r A' w% \. w! Y* \7 k
5 N/ @) x# B' A( m. E1 _6 e3 bfunction IsaNull(cCheck)
4 @( j V2 g2 [6 o3 m { ! s2 U' h2 k& x* _% |6 _
return(cCheck != " ")
' v( B1 x* ^# b9 I6 x# C; Z0 p E } 9 q5 V6 ^; Q$ ^
. S# U9 h7 _1 ]! _8 H; ?function checkform()
* U3 h7 a7 a/ d7 |3 A{ ; Y5 E# H. R9 G U' z3 q
id = document.sform1.id.value; 2 j! G- e7 f/ r$ \* m1 b
if (id == "")
: _+ H0 o I$ V; @ {
6 I y4 [6 y2 B+ G8 S alert("请输入注册名");
# D q# D6 E# L- A" L: [ document.sform1.id.focus(); ; T' S& I2 r5 Z0 o8 c) {7 ^+ \. Z: J9 M
return false; 3 z3 D z6 K' S" H# F
}
9 M. ^9 n* r9 }
$ @4 X8 s; l8 m4 y/ u' F! l' r for (nIndex=0; nIndex<id.length; nIndex++)
8 [0 G7 F- h4 R6 @7 a9 i; b { # s6 Q7 x8 g1 s+ ^$ i: U4 c
cCheck = id.charAt(nIndex); ' Q* i2 M# z7 i1 U1 F
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) * y- n1 r" _% C! M, j: i3 Z4 X' Q
{
2 Q) i& Z2 ~' l- v) c; b' o8 n, u alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
p$ B4 A+ b! b) f document.sform1.id.focus(); # p& M+ ]" @1 y
return false;
2 E' p8 G# Z; D" B }
9 F) L3 E* ?6 |. o! s4 I } 8 ?6 K6 _+ g. J9 C/ \
chineseid = document.sform1.chineseid.value;
8 ?( r3 ?% P" |9 Y" A, T- y: p if (chineseid == "") - {% s- w& D+ ^7 \
{
5 |. M( v8 B' f+ U alert("请输入中文昵称"); 3 D0 I8 Q( y4 S" S; ^, x2 l
document.sform1.chineseid.focus();
7 w" }9 z3 U0 A* r! _ return false; , ^% q' z! s F$ | c; c8 Y
} / N/ P9 O) c4 y3 _& N
password = document.sform1.password.value; # \0 v5 ?" W" R9 g; }
if (password == "")
0 n% J8 F' j3 ]7 I6 p( C { 8 e( K! ^; I" y8 O
alert("请输入登陆密码"); + H( I3 P1 p! e0 y4 U
document.sform1.password.focus();
# r i( s5 d7 ~+ F# F return false; 7 Q2 \ j. f4 ~4 ?( |. H
}
( Y1 d* Z2 ]! b+ i4 f: p password1 = document.sform1.password1.value; 0 m* o% o& K2 R' Y3 b
if (password>password1)
# ~+ E4 _) R: g( x3 H0 `+ F {
\# Q8 G% W& R& U( E alert("重复密码与登陆密码不相同"); 4 Z G% c, e5 V4 q" s i9 y
document.sform1.password.focus();
+ U& o9 v' N# Q document.sform1.password1.focus();
! F* X' e8 m% c' K, H$ s6 r return false;
# E* L6 k9 g' D } 8 `/ i0 W. i1 T* @
if (password<password1)
& B- G& z2 v2 \ {
" k" @$ W' d: s B* \ alert("重复密码与登陆密码不相同");
3 M5 w6 o5 g L. h: t document.sform1.password.focus(); " ~: v7 o0 j$ ^0 L5 H9 o( |
document.sform1.password1.focus(); ; p! |) f7 n! N9 K7 N5 E9 X) R
return false;. S4 |/ n6 u7 ?4 t: y
}
2 s# Y( Z9 C2 X- u: J. o6 O if (document.sform1.email.value == "") & ?: {: o" @. b( Q |- D x
{ + k( l s _" v. n0 K
alert("请输入您的E-MAIL地址");
" k# r. `4 B) [$ ] document.sform1.email.focus(); 2 \; `3 X% z% Y8 F6 v
return false; ! w' G2 _4 h. ~5 S
} 8 R) R( S# h# H; q
1 L6 s0 n; C8 U" s* h& E' ] email=document.sform1.email.value; 1 j G, m5 X/ ]+ B; U
emailerr=0
/ L x7 g8 K9 V0 k# ~7 | for (i=0; i<email.length; i++) # U* F3 o; C; z, K0 e% k8 E
{ 2 \* J! `6 G: s/ Z5 Y0 H
if ((email.charAt(i) == "@") & (email.length > 5))
- B) n: _! d" O, J" b( @% a {
* l1 b* ^% [* ^0 @ ^7 P emailerr=emailerr+1 1 q& F- u b% Y8 C D& q1 [; i
}
- y. c! h9 ]" `: T } 3 \ R, Y0 L4 n
if (emailerr != 1) 0 c& Y% x+ N7 a/ s
{
( \( q4 n! Z" ?+ Z7 Y% l alert("请输入正确的E-MAIL地址");
/ S0 z, D! a9 S document.sform1.email.focus();
7 e: }+ j) d8 x$ y V* |; u return false; 3 A; U' W: Y" C& i4 s
} % L8 o$ b7 h. [6 I3 c6 p. z
- I5 Q9 [5 X, S) g- v4 s/ x+ \$ \ if (document.sform1.checkask.value=="") 3 q! t! R8 v1 D+ c
{ / b4 y# Q j% l" r8 x
alert("密码提示问题不能为空");
$ w' V; M/ m( E4 F' A document.sform1.checkask.focus(); 2 D9 ~9 a$ h7 [7 T/ T: [
return false;
1 e5 A2 b- P) |$ i8 s" D }
& B5 g1 N) N( n4 B if (document.sform1.checkans.value=="")
0 g( J0 W6 s" N3 w {
$ q o" t# j, @8 {1 b5 i* U7 g6 F alert("您的密码提示问题答案不能为空");
5 t9 @- d2 N$ Y7 ]7 _ document.sform1.checkans.focus();
6 B. x& n7 Q* u$ V6 X return false; + ^9 m. T& s% G1 p/ w7 P( r) |
}4 u3 I1 q/ L$ Y0 @" D( K/ b
return true;
, z: @& R+ r/ s4 r _( h- X
; i+ B A. z7 r. m" x) r( P$ w}
3 E% x/ Q7 m }6 a</script> |
|