|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:
! v" i1 t9 |! @. `7 }6 z E" s4 ^3 _<script language="javascript"> 8 S6 c1 S Q+ \. ?. d Z, U- q7 }
function IsDigit(cCheck)
: o1 Q O1 V) `" P- w {
; x' y6 k. Z& A G. s! s- K$ [ return (('0'<=cCheck) && (cCheck<='9')); - C6 I3 c' ?, R3 u. O
} 0 T7 ^$ n4 C# q
$ C7 s% I9 N, F& sfunction IsAlpha(cCheck) ) `- G( E0 s2 w! U3 {
{ * T, l# H( T4 x+ W# x: F
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
. a8 F s& C, l0 ]: q }
" ^! @1 `7 I3 s! Z7 b! B; N
" j5 t) F5 m. xfunction IsaNull(cCheck)
) {9 _5 ?$ q5 i" N2 T7 \ d9 b& ` {
0 o6 L5 M9 q! H3 d) p# M return(cCheck != " ")
6 K0 u- }! A6 ~' T }
5 a. X% u) _ g! E' } 4 W3 R7 Y5 Y$ r5 W( x
function checkform()
. v# w- t7 w+ H' P{
$ e9 N+ Y. { E7 H3 X id = document.sform1.id.value; ' W8 G& a: ?# g
if (id == "") 5 }0 Y9 }+ o* \5 Z/ X
{
/ A" w4 q$ A: z alert("请输入注册名"); 1 w k) S& c% j$ l6 D f
document.sform1.id.focus(); : \* d0 e6 y$ J( m
return false; 6 \4 c3 a& m- f" Z
}
" t! M! A: H( t & p. e0 @8 g! W( o" _* k* c* o
for (nIndex=0; nIndex<id.length; nIndex++) ) L' e5 F/ j3 `0 S
{
~9 h& \/ M1 l* z4 z5 Y0 B" ?3 E cCheck = id.charAt(nIndex); , l5 I& {* I1 P' x: ]% a% ?; q, K0 y
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
( n: B& ], \ c( ^: `: N { + U/ ~, ~$ ^7 |/ J- [& M
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : T J' t, I" O+ a% w
document.sform1.id.focus();
* i, B+ q3 f& F0 n return false;
4 F' N0 [" [1 j' Z } ) f% W# P/ c" P, O
} 1 v( N5 Q# d& Z5 u8 F
chineseid = document.sform1.chineseid.value;
6 n4 f% o. s$ w& p" a! O+ x if (chineseid == "") $ }6 I- [3 d m: r# B* A: s* w- w
{ 7 F& [) P$ S+ y; G5 T4 W8 t
alert("请输入中文昵称");
9 ]& V7 i% O" j& V document.sform1.chineseid.focus();
4 S8 i6 S8 r |- V return false;
1 r' e! F" n" e# G( F" y- e( n } : Z4 v0 \ i& b3 F) A$ T! r* t6 u
password = document.sform1.password.value;
0 C' e$ Z. Q# h; b2 c if (password == "")
( S( p2 P' ~% v { 6 F8 a# l+ T! `# g+ m8 c' C. z2 W
alert("请输入登陆密码"); ) S1 p! |7 s( `' \, M' T
document.sform1.password.focus();
+ G" ~# A; s! ?' j return false; + N2 M5 k8 V7 T- [8 d3 \3 Q' B
}
, W" V- r; K# l3 d/ o4 j/ c$ Z password1 = document.sform1.password1.value;
! ~( J; @: P. l2 z9 E8 `3 F( H if (password>password1) * N3 j' G- j1 {
{ S! [# d* R: C/ W# _/ p k' G
alert("重复密码与登陆密码不相同"); & @1 E: \0 q8 y2 v
document.sform1.password.focus(); 2 S. ?6 A# b. l! D& ]3 `3 ?* p
document.sform1.password1.focus(); * |, w) D+ O- |( I' W1 A- R7 Y
return false;
, Q0 K5 w/ y* B }
" f0 p, T& W& Yif (password<password1)
6 y, r& H- e! P! P$ k' _ {
7 \: m1 c9 G( c. V# w: K( @1 E alert("重复密码与登陆密码不相同"); . ^- Y2 A! U7 c- z, H
document.sform1.password.focus();
# r) C _: {1 j5 f- d. Q% H& _0 F; t document.sform1.password1.focus();
! j6 G5 a _8 y E return false;
6 n5 J0 ]# f5 ~. s } : j' U( @8 L$ D- n& g6 r* g
if (document.sform1.email.value == "")
, i' a4 N8 r1 I V& k) l1 R {
1 V% y" n, w3 @* n! V alert("请输入您的E-MAIL地址");
) r: l& O" p! s% B document.sform1.email.focus(); 6 O. C1 y1 Z5 w# F
return false;
$ L, }3 `# y6 S6 h } 3 W. U& Q- L7 d* l5 }
_2 K/ t. ~: y/ g/ N: }' f) h
email=document.sform1.email.value; , B$ ^; [+ k( S M* Y: n
emailerr=0
: ?. L" Y8 X9 J/ b* y for (i=0; i<email.length; i++) 0 w! v4 G/ r& z C& O' z0 L- H
{ ; r5 K& f+ m0 z2 o" q& y# Z
if ((email.charAt(i) == "@") & (email.length > 5))
% p9 G+ M8 e- z. u4 m { * O: ~5 N I* X5 H; L, K$ |+ j. M
emailerr=emailerr+1 * o- [, C! `3 {1 _
}
) e+ g! j. V, n9 h) ~1 \% ^8 | }
+ @" r" c( D7 J2 m3 q: u if (emailerr != 1)
( w% |2 M) b4 ]4 K& j- j1 s {
4 f& r' L! y: w% b* W; H2 c! ]( O alert("请输入正确的E-MAIL地址"); 4 C( P4 Z7 d% \: _- {. n
document.sform1.email.focus(); % z H+ C2 U% {0 @+ r+ Y
return false;
8 x! [5 M7 H% ]3 F0 | } % o4 C3 \2 o; j: g; k6 g
0 _/ p. z# {8 A5 s( O$ G$ N, M
if (document.sform1.checkask.value=="")
# u' j( f R1 \7 C; j: n3 d( V1 ^ {
+ X6 W! t+ C: o& Z2 u( t/ S alert("密码提示问题不能为空"); . _4 c' E" B8 n& [3 I
document.sform1.checkask.focus(); 0 |- v% \! y# o! A7 L- i2 }( P
return false; 9 Z; }+ Z1 e& @& n
}
# k* n: [% `* M. {: A5 | if (document.sform1.checkans.value=="")
! n1 `; ]7 t# a8 o3 ~ {
2 Z5 K0 E) D- g% B$ d alert("您的密码提示问题答案不能为空");
; a' j/ y! I/ S+ r* _: H: B document.sform1.checkans.focus();
T% l j' b8 f: j4 D return false;
1 S( D4 W& C+ O( v* U2 f }
]( W9 |/ u9 \2 @5 s return true; % A! r8 m6 `/ r5 l* D
$ k( ^! o+ [# X; _5 ]4 Y# U9 A) B4 d} - [( W3 g4 R( s3 f! v% D# x1 h
</script> |
|