  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:' ?1 i$ D* z Q: f
<script language="javascript"> ) T' x$ W% C& ?4 g2 B
function IsDigit(cCheck)
/ q0 c& t6 Z. y/ E9 l { " S5 I0 C0 t8 S. b3 y. M
return (('0'<=cCheck) && (cCheck<='9')); : I9 `9 K$ H) P8 \; ~3 Y
}
% X! W: g9 o! w& n% `
9 H7 {: L4 X* c( O$ r. y) ^! ~" ?function IsAlpha(cCheck)
( _7 o: p, [: @& ]& R W* G { ' A5 n) `; v5 B; Q ?! ~2 a
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
& K6 {* C6 r$ d; D1 p }
0 a; N( ?& W1 T/ v: Y3 c! R4 A 3 c4 P# k$ z) C5 K8 T" m
function IsaNull(cCheck) # ^3 j! o& R; {0 `, J
{ % E; d- c9 b0 a2 D
return(cCheck != " ") 0 S7 ~6 U6 n+ o
} / E: f* @% |( G' i5 F V: A
0 x7 H$ P* J: x" Ffunction checkform() & o- `, D5 h" P; H: S
{ ! ?6 w5 {1 m$ B4 O
id = document.sform1.id.value;
% M {& m# r7 g) Z) M if (id == "") ' _ ^ @! J2 D( [$ ~
{ ! d1 y1 O8 e$ p+ |0 N% h
alert("请输入注册名");
# Y, [% J$ p+ Z document.sform1.id.focus(); * y1 d7 n: l/ {4 C$ w p
return false;
4 X. S5 a! m1 r/ Y! [* l* E# m }
2 O( o) S1 Y8 Q6 } - \2 g4 R1 S' A- @( ~
for (nIndex=0; nIndex<id.length; nIndex++) ) l) Z" c, u6 |+ e! w
{
( w7 @ }) b _7 } cCheck = id.charAt(nIndex); # E& T9 U3 C( c3 x% o4 J
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
4 C: O/ t3 N: f! c {
% n8 Y9 ^; b3 y, o2 [! \1 q% R, }. e alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 8 j9 Q% [' r) }! A
document.sform1.id.focus();
- U+ }' b% [* H9 T2 x! W8 ?7 | return false; ' f0 C0 I1 w3 _6 {* H) T7 y' ?
} 7 g V4 a- E8 J. J$ m8 m& {) L# A
}
0 d8 k" q5 K, U( t) ~% ?. b$ Y- t' o( m chineseid = document.sform1.chineseid.value;
& s' L+ n+ Z, H1 V if (chineseid == "")
4 T% P2 F5 x" E* r- c {
( x$ {( e5 O. U1 A8 s/ M/ L alert("请输入中文昵称");
4 M- O4 P! y, }6 S, H8 [+ } document.sform1.chineseid.focus(); , b/ P/ Z: o% s' E C' x3 ]* q
return false; 7 |9 V* F0 x. O: S- D
} : W5 s. Y6 H! g' J
password = document.sform1.password.value; - o& y0 \- p& ] A5 i
if (password == "") 1 T1 O, {4 a! V' @3 t2 m/ S2 z% ^ Z
{
) f* ~: }# f' J% V6 O6 S0 i: g alert("请输入登陆密码");
* F3 e: f& V/ H( L: z document.sform1.password.focus(); ; ?. ~( P$ L/ k4 ~+ g# Q3 [7 O
return false; ; {3 X# P3 n- m: l7 G; h
}
6 W" h2 W1 v! v" P* n password1 = document.sform1.password1.value; ! L5 _1 s+ [; g: X) e
if (password>password1) $ ^; H) _( m+ f
{
' K7 ?* ?( s, U7 r4 C5 P+ `/ T alert("重复密码与登陆密码不相同");
6 w/ y5 [0 t9 v" N9 P9 J document.sform1.password.focus(); ) D; I; R9 J9 q; W, V
document.sform1.password1.focus();
/ a' z2 f: Y, y return false;- |6 p9 H% @1 `$ g
}
3 S8 W( X# b/ n. ]: D5 ^if (password<password1) 6 u) x1 v9 |# { W
{
) N" \& x4 L6 ^0 R O8 R alert("重复密码与登陆密码不相同");
" [0 z+ a1 @* G document.sform1.password.focus();
+ b$ ?# U. ~; Q7 ?2 Q! o$ u9 w0 Z document.sform1.password1.focus(); 1 Y9 b" ^0 @. F( E2 F
return false; i# }6 V# N$ U3 s/ v9 o
}
+ T7 s C0 p$ ^. C) f) e h. B if (document.sform1.email.value == "") 4 n x% B& l v+ s* H) J, {
{
# _7 k; l; v- @# A7 e. J alert("请输入您的E-MAIL地址"); ; P: _/ j5 {) ~) k3 E
document.sform1.email.focus(); / [ G* J3 d s. ^3 X# G1 r
return false;
# @+ n$ C" H, ?3 n/ W0 Y } . p" e5 {/ j0 y0 o4 ?% H4 @
( V; _0 u& h; t4 ?; a email=document.sform1.email.value;
7 U! @8 h$ X+ J- S+ J. \ emailerr=0
2 `5 z7 a. w2 M, a" l+ c* Q9 ` for (i=0; i<email.length; i++) 8 a6 W! _/ N' x) ^
{ % d8 J! O% U$ o3 x7 `8 t
if ((email.charAt(i) == "@") & (email.length > 5)) + e1 h1 P6 Y4 P
{ 5 [" c$ [+ k1 d1 v
emailerr=emailerr+1
5 ^( M- W6 U' v4 z: t0 w0 W2 _ }
$ j$ ^- _5 t* o9 T }
, M3 e" h% t6 d7 h } if (emailerr != 1)
- C$ ~: m, D. }6 {1 [ {
( g4 ~0 J# S: U alert("请输入正确的E-MAIL地址"); 1 z3 Z+ M1 }+ C* A! U# k
document.sform1.email.focus(); $ v" ^( ~5 z d! ^5 q" U
return false;
0 R; W/ m2 C2 m) Y0 k- J/ q6 \ } . F& |( c4 F( k& e+ Z0 B( ], Y
" o+ T# a% Q7 b( P' `% H2 t. \ if (document.sform1.checkask.value=="") 7 C, _, }3 d9 L8 Z
{
8 Q [( h: `& `$ P; p2 ^3 Q3 L alert("密码提示问题不能为空"); 3 x- h! x* @- \ V/ ^+ H. x( q# w
document.sform1.checkask.focus(); , O7 d( |& o# I- ?) _
return false;
, Q; @3 U8 Q: I. T9 \ }
7 T4 n: _% c! K5 w if (document.sform1.checkans.value=="")
$ G" c0 p4 [/ T. T { / K# {* y0 ]0 @9 y- N4 s) D
alert("您的密码提示问题答案不能为空"); ; N9 p# Y" @( X7 Z
document.sform1.checkans.focus(); ' P9 q5 Z9 I( v' ^7 i% D
return false;
: k, X, M- f1 h1 J) M& W }" @: x+ d5 \4 k" B! {
return true;
6 g; h: t6 x% _! C
% b+ h: g* n$ p8 K}
6 C1 l7 n7 K- ^* l o. e, L+ u</script> |
|