  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14193
- 金币
- 2387
- 威望
- 1647
- 贡献
- 1335
|
这个脚本对你可能有帮助:
4 {& |" c" D( W% N<script language="javascript">
- W" O$ Q+ y& R1 Nfunction IsDigit(cCheck)
- o# r8 S$ k. K( y7 M { ' c4 I4 A8 A8 f, U( @5 _
return (('0'<=cCheck) && (cCheck<='9')); 9 l" K/ x: r: S3 Q. F: d5 u
}
0 d9 N. r# p4 q1 H 3 M* r' A* u! Z D9 ~
function IsAlpha(cCheck) % E. F J+ o7 Z& L, P2 L3 i7 O
{ ; ^2 B" i( m M; _+ Z" ?" G# I# G
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% ?3 y* X2 B% Q% M6 @ } ! A7 t# p% z5 m) \$ W1 o
. ?; X' B! Z, B5 }+ kfunction IsaNull(cCheck) 1 j8 K- m Y {1 [9 D
{
- z& ?! R. p) o9 n4 A6 E3 b3 l$ x return(cCheck != " ") ; g+ N" M/ K/ `
}
S0 I- L$ t0 Z4 c2 K( f* D Y5 k
' \" r% I" f- s! K. efunction checkform() 1 R9 r) E! m- e3 E- h5 {- c
{
+ z8 e, J% ~2 _2 I- E8 y+ b id = document.sform1.id.value; 2 J# J8 X8 G% m, [) A( D
if (id == "")
: Q2 `$ p6 B- q/ r' P3 ?% T {
! f S) W L' Q. o alert("请输入注册名");
) q: c8 n+ \+ G$ Y% w document.sform1.id.focus(); ) I; I# J5 l' i, F: h9 h9 N
return false;
3 | e& ^9 `' Q! ?/ C Q1 i } - [" y! u: U0 ^+ g, z
# U& d8 F! v% o$ P for (nIndex=0; nIndex<id.length; nIndex++) 7 h: p+ F' D& I& w6 P# {2 U* P- s
{ 8 V! Y/ l( A9 ^7 s9 H& q
cCheck = id.charAt(nIndex); $ @) f( ^! |$ [; g+ q
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) . x& z+ o0 R$ n) I- q& t+ o" r
{
7 r J. ~" H! B1 C" Q) b alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
+ B2 C7 _0 L- J6 G, i3 l& } document.sform1.id.focus();
5 a% d: F6 b8 {* [7 q b4 Y return false;
7 O0 p( A' F7 V; @4 Y4 l } ( U5 \. `, J7 @$ {( L# l
}
4 q2 y0 {8 Z/ c: w0 ~7 I2 A' u3 k chineseid = document.sform1.chineseid.value;
& h" m4 o" v& n. o& a4 }0 N if (chineseid == "") 9 L o$ u' F t G$ `4 a7 i% s2 d
{
8 ^' O7 A* T* f7 J alert("请输入中文昵称"); 4 L; x* [! f5 i3 B$ ~" r$ ~. U* Q: H
document.sform1.chineseid.focus(); % f" |; i2 N9 L- A$ c
return false; 0 F# W( e0 N& }7 k; m# s9 D0 L
} . J" [6 H/ v# U
password = document.sform1.password.value; ' ^8 S& [# X7 w. s+ H9 z
if (password == "")
2 y. e6 W& |7 c. L, ? {
3 g- _' w6 f& ~0 w: k alert("请输入登陆密码"); & Z' {6 ]# p7 w" T' G- _; C
document.sform1.password.focus();
' z' N+ s2 Q& R9 j9 v4 C! W) y6 T return false;
% p! X* J3 V1 a6 o& Y7 q }
" Q' ~1 F* m0 i; c5 D/ H password1 = document.sform1.password1.value;
+ z& j( Z4 i! g if (password>password1) # u, T# O: W) w1 t' h) n7 k
{) k! x9 r5 c% V! E/ ^$ D2 k0 w+ A0 p& O
alert("重复密码与登陆密码不相同"); & U' t: e1 j6 X/ j# z' k3 S. e
document.sform1.password.focus();
5 P1 ^$ O: H8 ?4 ]. `8 ^ document.sform1.password1.focus();
' }) G( e1 N" ^$ o6 z return false;
: J8 ~ }8 C" Q+ V p }
' x5 j: p" L5 S$ Bif (password<password1) ) R( B" z+ f1 L
{
9 q" P) A5 ]7 m l8 G. n( u alert("重复密码与登陆密码不相同"); W7 {5 l: N* ?1 N/ A! ?# G
document.sform1.password.focus(); * X+ D0 X0 C5 r: t# g' W$ b
document.sform1.password1.focus();
6 m2 s: C0 h! G ?! C5 J4 {4 f return false;1 m7 V' ~7 I1 Q! v, R7 |/ g. i
} , }* s" t+ w# _4 ]
if (document.sform1.email.value == "")
) G x7 r& c9 [% z { $ G% v( @$ D/ V- J
alert("请输入您的E-MAIL地址"); " |( ~- S- U* {0 J% K
document.sform1.email.focus();
. T7 [& q' T( z! n& b return false; " ~9 r5 O% o) ^6 y! `0 T+ t
} & ~- B7 U$ ~+ R5 a; T: l; e5 R/ ?
1 w' N4 I* M, Q8 ` N+ [( j) J
email=document.sform1.email.value;
7 w! U- T- y3 m emailerr=0 + r4 \2 q! v9 K0 K! k* l$ k. V
for (i=0; i<email.length; i++) 4 J# c/ t1 ]2 k- m! R
{
; e) i" ~ V. J8 s) H8 A if ((email.charAt(i) == "@") & (email.length > 5)) & E' u8 ~/ T: j! _
{
7 f( C. \! @1 F3 e emailerr=emailerr+1
+ o9 [0 O: F7 r' J } : R$ \' O0 O% V! G2 j
}
) P" v: Y' v4 w if (emailerr != 1) ; t+ j" |7 G- V* Q
{ * g) w. ~ z! Y1 k! @
alert("请输入正确的E-MAIL地址");
; x/ V/ b9 o6 }! { document.sform1.email.focus();
2 {% t& e( l: p4 I9 F* l& | return false; 5 o: i0 R3 S9 M4 K! z
} - V- H. T" h- [+ M0 a7 I; H
2 O6 x" P1 S4 C8 t& Z. R% V if (document.sform1.checkask.value=="")
3 q8 } r7 A9 `2 W {
0 R2 d- X, M9 V w: B/ r alert("密码提示问题不能为空"); ; q+ `7 b' p9 s) @
document.sform1.checkask.focus(); 2 h) { g# s5 h- }+ t# K
return false;
% `! `0 _7 `* W& R4 J+ G& l } 7 }- [! `& y2 p( E5 d) \4 i
if (document.sform1.checkans.value=="") + y$ q9 P$ s7 c7 y0 |
{ . C" j8 j. Z* C" a
alert("您的密码提示问题答案不能为空"); ~. R1 [# ^1 a! `
document.sform1.checkans.focus(); L4 G8 |9 V1 u. l& H
return false;
+ `# q" B3 H6 s3 F" a# d0 X }1 |% P, m a# u& F* y4 ]
return true;
# I+ k1 T5 H7 b5 L 4 l7 `8 H) g- A0 w E
}
8 G8 T8 ?# q. I" m+ o0 ^2 U</script> |
|