|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
这个脚本对你可能有帮助:) P/ i& V) A' D1 I* m z4 U
<script language="javascript"> 5 |5 E1 _7 z' C) e, G/ Z
function IsDigit(cCheck) 7 H0 @ w9 \0 V- g* E
{ 2 Q( f" ]$ j. r# |7 G- n* q# G
return (('0'<=cCheck) && (cCheck<='9'));
2 x# e2 z$ E" w' w/ Q3 k }
& |5 _* G! W. t& D% }) I* ` + w& d' Y% b- _+ [5 E' g+ G
function IsAlpha(cCheck) : w- O- m" e3 k/ Q* o# H! l
{ 0 f- b4 \/ m: F) S/ L) A: ~
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
- z* w; \/ e0 w) r" J }
, m; ]- |) V/ s$ g, b1 o
7 z! Z/ o, q" h3 l, J0 \function IsaNull(cCheck) & z: y: S) Z. S* r+ u- z1 W
{ ; x4 i* n: c" `# w6 `
return(cCheck != " ")
1 j! ~5 Y/ ]: |6 i+ _$ L } 2 z* ]' k0 ^7 ~5 V" A9 o8 z5 Y
: L% R# z. v; O0 a' s9 `function checkform()
0 P2 W; L0 k5 s' s" _/ k G! }{ # D" H4 U* R; `0 @, a5 A! x( m! X
id = document.sform1.id.value; + Q, I% C9 k `! h( f1 a- h S
if (id == "") 2 H, d" z4 Y# M Q
{ / p: P$ }2 p, M. l
alert("请输入注册名"); 5 M5 p7 |' a& h( I
document.sform1.id.focus();
) D) l8 c# G, z! g1 z9 p8 \+ M* P return false; 2 m" z3 [8 e0 \* e2 ~ D
}
7 P4 u8 D/ i: t7 J; i/ J7 O* N, a 6 ]% k) A/ M: s/ V. U5 N
for (nIndex=0; nIndex<id.length; nIndex++)
4 v' E4 W I( G% v% d { # x# r! G; V+ H5 H/ f8 _0 s9 Y
cCheck = id.charAt(nIndex); ( @3 H0 {; k- O( F" V6 Q
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) ]6 }! b, {6 o1 d, O" ?) x
{
8 s2 G+ b4 c2 \ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ; s0 J% b7 l0 h/ O! D0 ?
document.sform1.id.focus();
! \. w% G5 f6 l return false;
/ o! ^+ p/ V$ q+ n } 2 Y2 N/ _: h2 G
}
6 f5 G4 _/ C8 x* Y# b/ c0 I8 u/ V chineseid = document.sform1.chineseid.value; 8 f* D' V( M! O% k
if (chineseid == "")
) Y5 C$ G# k7 p { 2 \" K( E1 n7 | f% o$ ^
alert("请输入中文昵称"); 2 ]* v5 {9 b$ l9 I6 s
document.sform1.chineseid.focus(); & x- W! W- h* i% K- L
return false;
C& H, M& l# w4 y$ v } 4 j# y% A m |- V; ~
password = document.sform1.password.value; , O& C/ Y7 R6 n. A" o* |2 }' I) @
if (password == "") . g0 B3 J2 f7 C! g8 Z" W' U
{ ; a" p8 G" w; w# z( a
alert("请输入登陆密码"); ; d7 G" Z: w- `& h; X, M
document.sform1.password.focus();
; E+ S7 i) y6 R# \ return false;
* u) b7 I) t4 [* N, ~% R }
( I4 y) V2 {' U8 |! e password1 = document.sform1.password1.value; ) b* W# r" ~ O* j
if (password>password1) + K3 S8 W" p9 L; j. F/ H6 h. {$ N
{7 l3 O6 {+ z: d' K: X
alert("重复密码与登陆密码不相同");
; O* v+ Q- k" y& h document.sform1.password.focus();
) s( z/ j% i9 V6 A document.sform1.password1.focus(); 9 i& j& Q7 K+ H
return false;- Z/ A+ P6 w$ |0 U
}
/ V1 J/ `: Z* D0 I! bif (password<password1)
9 e: ^: T/ F" a* ^* w. H {
8 b: t2 O2 i/ \) y' D. _ alert("重复密码与登陆密码不相同");
3 X3 f/ U1 {' `6 h6 p document.sform1.password.focus();
( Z: L3 O+ w/ Q4 C document.sform1.password1.focus(); + j6 m) e, ?) w! L2 T; ]: [- J
return false;% F& ?1 ]" H4 g* C% Q; m: I, l
} 6 ^# L1 J- w' P5 `" j! y2 {1 o
if (document.sform1.email.value == "") 5 _! l: j8 {' a; d
{ $ A1 S: G% T* Q R
alert("请输入您的E-MAIL地址"); 5 ~) o- F6 h4 f, h( e6 Q0 t) p
document.sform1.email.focus(); 3 W2 l7 |6 V. D+ K7 e
return false; " f' p( n3 Z- A ~, s* _
} & \* x# q2 r0 I. L3 _
5 T6 F" Q- v& K" w* h% e; H1 l- K
email=document.sform1.email.value; ' [* [7 j" g4 N5 B3 f7 B8 V
emailerr=0
0 k M. L) U; A$ _' H8 u1 P7 a for (i=0; i<email.length; i++)
( t9 l- G# Q& t- |/ R { $ j6 N/ ?3 ?' S
if ((email.charAt(i) == "@") & (email.length > 5)) ' A4 X7 I; y0 w9 Y! J+ v Q, D
{
2 J- l' L- d2 y8 G3 T6 s emailerr=emailerr+1
+ S: W0 A$ I: n+ q$ w } 0 V9 F# @7 [/ C) B' V$ A
}
/ p! d$ D% B9 f" z m if (emailerr != 1) . w. n ~! a. R
{ . Y# n) K, ~8 @2 T. M! G+ j
alert("请输入正确的E-MAIL地址");
: d8 Y; Q0 y) G; l! d/ l- f, D document.sform1.email.focus();
+ {: q/ ]7 x: R! L; g7 V# c4 ~ return false;
7 n9 Z) i7 X- Z$ _: } } # H( w2 P# \$ V' M0 R6 H7 X. ]
P; M7 P7 L% Q, K- p& d% K3 g! w
if (document.sform1.checkask.value=="")
9 k+ W3 w) o" d! n m2 J7 ] { 4 \# z5 K! P6 l# ]2 o
alert("密码提示问题不能为空");
( W) _4 g& p% ?1 [ document.sform1.checkask.focus();
1 h5 O+ J* O# b6 L! `0 n- ~ Q return false; - ^+ e6 w$ v, k
}
9 k7 Q- A1 n# d5 m, g7 q& |( t/ _" ~ if (document.sform1.checkans.value=="")
# v% a. `) @7 F( T {
/ u0 O' K& ?$ B) h$ b alert("您的密码提示问题答案不能为空"); , n- d$ W% d( C* u
document.sform1.checkans.focus();
{& ]1 `& S" ~- T6 S' \ return false; 2 r5 k! |: y3 v' Y* L7 s& Y) D
}
7 ]0 S& ~ F6 ?, L J; k8 ? return true; $ K+ c! K2 u5 _# c: ^
6 Z# _4 c% w4 l, g! U1 w1 d5 i}
0 M7 R* s! L1 Q, [8 ~- I</script> |
|