|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:
3 k" t# Z2 y- k4 h, E<script language="javascript"> 1 h$ e4 `5 N# N2 i! w
function IsDigit(cCheck) ! P- t \" d& m# p- j7 ]4 B
{ ) T3 {. l9 K- t$ D* B6 _, l7 }% M
return (('0'<=cCheck) && (cCheck<='9')); & R6 D1 ~2 X- w4 J4 p
}
F! |, }1 M4 H. M" [8 M7 Z( Y$ m
' h4 }/ |2 ?9 [; S- i% Lfunction IsAlpha(cCheck) 4 J" z$ ~2 s2 F5 t" b6 E
{
' e4 B" a0 I% ^ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . j- ]1 g- D5 K8 F/ T
} # ? { G) B5 {: D7 w( c
1 W8 b5 L. E% h7 v0 A: H6 N
function IsaNull(cCheck)
" ?/ R* W* t' r {
% E1 }: }+ w$ h' Y" ~7 J6 l return(cCheck != " ")
0 y7 E% p* w n$ W+ t }
% ^5 C+ }" Y& Q: @0 F# Z5 U- d" a
6 \% a8 \5 v# ^- t8 S% X$ g6 F2 Sfunction checkform() ! s, I: J3 ?+ M; p, O4 l7 g X# l
{ . |2 y6 h) H0 ^$ o2 Z. |
id = document.sform1.id.value; 2 m' w* c8 o$ r( r! g# A% v4 k! `
if (id == "") 2 t9 a2 L6 m' E% N" F
{ # v" }7 H! w, V% {
alert("请输入注册名"); & u3 Z0 b, f2 J$ y; S$ G t
document.sform1.id.focus();
- J+ e! E* V0 k' ]1 k return false; 2 M& _' z2 q4 T6 a6 C# z% R5 @
} 4 L8 \0 Z/ f+ z* {% |& P# ]6 Z% h% o
( n8 v- g/ H' s* S d2 U5 H8 r* O
for (nIndex=0; nIndex<id.length; nIndex++) 4 `3 |4 I/ p1 V
{
1 s, _1 s4 P; ?9 ^- G" ] cCheck = id.charAt(nIndex); " }1 j: y! V& F& G
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 7 E r. p: m _ j, w
{ 6 Z) `# t- C' I" J+ y
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); $ W! L/ N6 H, q+ v1 f1 Z+ d+ _
document.sform1.id.focus();
: T4 J" d% S7 e5 n return false;
# o5 J8 c1 I( _$ V7 G }
0 H+ Q& `0 E. B' K! B/ P- k( c4 ] } 8 _7 l* P9 O o* A: R$ C
chineseid = document.sform1.chineseid.value; ; K* C( J& T* P( B$ K
if (chineseid == "") , M; S% Q! _) m' r( i0 x" q
{ S( y, _$ g9 ?
alert("请输入中文昵称");
2 W8 z; m, j- r1 h+ E2 D9 N document.sform1.chineseid.focus(); l( g9 @& H: `. `8 b6 c
return false; * {7 }: v2 o, e, [2 X
} ( v6 {1 g+ ^6 S3 i5 J
password = document.sform1.password.value; : d0 Q2 g6 p: D* b' s! `
if (password == "") 2 ~! X" t6 u& ~5 V. S
{ # {8 w0 }4 s* e; M7 h
alert("请输入登陆密码");
% O* w7 Y& l7 m6 P2 W document.sform1.password.focus();
. a S; S+ X. r+ x- E m return false; 1 ^7 k; u" z! V& u; l
}
, q) m7 C" ~, `: ~0 v password1 = document.sform1.password1.value; 3 S7 e) a5 p% A5 E2 H; S
if (password>password1)
( V. a' j% y2 _) U5 F; |. B {
4 [% Q; q9 G9 L* p% S( I6 z( F alert("重复密码与登陆密码不相同"); * }0 Z" s/ L* b% ?2 J1 v
document.sform1.password.focus();
6 U5 g2 m, l- g- [ document.sform1.password1.focus();
. d" A( H, G0 K+ ^- B% Z) @2 w return false;
- G4 ^7 [; s5 x+ | } 0 B3 J7 r; h$ j) |& H
if (password<password1)
, ~/ I7 f' k/ l/ h {
! k, k9 S8 i4 a5 w. {& Z alert("重复密码与登陆密码不相同");
/ s* G: f8 f2 ^. g document.sform1.password.focus(); & ]4 Z" J! f+ P: t# a
document.sform1.password1.focus();
. ?7 R/ e( Q) r& ^ H; R# X return false; v; k- x6 _, b
} 7 J6 H1 Y# J5 I3 m* O
if (document.sform1.email.value == "")
! ]4 a- o& j3 p( U' T {
- R# S3 N5 u- z% ]; y alert("请输入您的E-MAIL地址");
6 a5 ]) K/ S2 n% }" @8 g document.sform1.email.focus(); / y: m5 ]4 V/ y1 \7 @
return false;
% z, V& t) {0 v7 o* q } - S& v1 n6 Q, e
% O2 }" t0 S4 U x/ U1 u" } email=document.sform1.email.value; , G. `9 {& Z, q3 X" }1 T( C, x
emailerr=0 , I I# }! D: R; m ~
for (i=0; i<email.length; i++)
2 a' N" D) Z5 }* I) T+ e+ y3 a { 7 V2 k; `+ L9 c
if ((email.charAt(i) == "@") & (email.length > 5)) ) c* t6 V; Q, E9 N; W3 P
{
; [5 ~! E5 s2 i0 V! W9 ] emailerr=emailerr+1 $ ]3 A5 x1 d- b5 x
}
+ N' z5 N( u5 {* J }
8 K' T1 }9 j! d1 h1 }# \. y if (emailerr != 1) ) V& N- @5 T+ s8 ^
{
) D* G0 X$ Z' G alert("请输入正确的E-MAIL地址");
! T- }+ d( s6 b: n$ ] document.sform1.email.focus(); 9 y3 K4 ~8 x3 Y+ C/ J4 j8 K
return false; : R4 Z5 J) o% `9 R! y1 R ]7 `
}
" V" O: Q" w) M8 u/ C; r * [. A2 Z( L1 O, i
if (document.sform1.checkask.value=="")
6 T8 [$ z4 h+ b; W { : Y# Z; W2 z9 n* m
alert("密码提示问题不能为空"); . Y, J K& {" g% o: J1 |. |
document.sform1.checkask.focus();
" m; O3 i! k+ H7 b% T return false;
' W# q/ H+ ^4 S }
" R6 n% c$ d8 b7 {. y6 Z; T1 s+ P if (document.sform1.checkans.value=="") D; r$ ]' w9 b* I
{
7 w: y/ |: G+ Z( A+ @ e alert("您的密码提示问题答案不能为空");
( O: f8 G: o7 G& V9 e7 V9 G4 B7 \ document.sform1.checkans.focus(); 7 j9 v1 k" g# O* O: |4 H! q1 a" s
return false;
) n# c3 R* R! O* d, E l }
+ O4 T/ l+ u0 O return true; * ?1 E4 O0 _4 d
$ j! `5 ?& [# T0 T1 I- J8 @9 O
} 9 y7 F- C2 Z6 o+ A3 ~- q
</script> |
|