|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:! ~# j% M5 U6 x+ f
<script language="javascript">
) O- P% G; j- Q, efunction IsDigit(cCheck)
g6 n4 o" v, d# B9 ] {
6 h% L5 d! }( y# `# ]2 p" S return (('0'<=cCheck) && (cCheck<='9'));
; O( D- s+ v, N. j; e0 h } 5 |0 z& ]5 ]+ E$ \: C& K
# Y0 s& x" R) a7 s- t+ S5 m# o
function IsAlpha(cCheck) % u4 o8 n$ e4 E2 N' l
{
0 V3 {. O) q$ Y& A, a return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 E$ t B3 M( w0 d2 R+ t4 S, T
}
! w6 Q9 J* a" Z3 g4 e s
5 q6 ~# q# ?% K: e4 yfunction IsaNull(cCheck)
1 p* U$ ]3 g; E) C7 h { 2 i, f1 x4 j! u5 U+ `2 y& K
return(cCheck != " ") ( U9 V" X( J( S& B1 n) Z
}
* ^& r7 s# J# p ! s5 a9 a9 \# D7 p
function checkform()
1 t: w8 f5 @ c1 b2 u H{
: u5 ^, O6 \! P7 E8 C0 u; h1 K id = document.sform1.id.value; ( e9 S$ L9 m# e0 L# o
if (id == "") ' O+ M1 X! X1 \% O% _/ D3 X0 i* M0 q
{ 0 g/ t6 A& [1 w6 v2 y
alert("请输入注册名"); + ^8 K1 V% \. ?+ {$ M
document.sform1.id.focus(); ' N/ ~6 L# j6 c7 Z7 p) y
return false; . p) d% F: Y) F
} ( M Y# c- V( r* W" Y/ s
) P0 C9 m$ s; q* K k0 u for (nIndex=0; nIndex<id.length; nIndex++) 7 B0 t5 y+ Y* l$ ]6 C* f
{ 8 O8 d8 V. }5 R% C
cCheck = id.charAt(nIndex);
: g6 J% {4 f1 I! V% c if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 3 P" P! w/ G" T5 T9 ?
{ " |# u# d1 @* K& B1 o: V8 ~+ d4 O
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - P, Z. Y; o$ }5 K' k& t: I3 X
document.sform1.id.focus(); , y, K) a5 Y% k# `4 |; V; z% T
return false;
- c. A! o6 C5 J% H1 E) \; t }
0 }: J* H H& y S5 w* Y } - t. ^. ~$ L% {' U( d& n
chineseid = document.sform1.chineseid.value;
/ N1 k+ Z6 R+ Z' e( h3 Z" I% s if (chineseid == "")
1 ?% Q, `0 b3 G3 T/ _ {
+ ]3 Y& B8 b7 d( w# P7 B alert("请输入中文昵称");
^0 Z4 V7 j4 i" U1 x: S document.sform1.chineseid.focus(); ; ]; ^ A$ k5 v$ P0 B' c
return false; . ?+ @% V/ e' }& k) n
} 4 s' f' U+ P7 O9 Q1 y4 w+ t
password = document.sform1.password.value;
6 f3 x9 p! {. Y6 q: p- Y if (password == "")
4 s- j& d: o) N( i! b! w {
. m3 W8 v+ H0 m( \ alert("请输入登陆密码");
0 O! ?: b7 j9 `6 n( H2 V! ^ document.sform1.password.focus(); 0 _! b0 D# e" C
return false;
& V- ]- v3 P0 W0 y0 Z } " E$ `) E! j1 \/ h* U/ L
password1 = document.sform1.password1.value; 1 Q$ W, K% |) L2 ?8 I7 O, M
if (password>password1) # Z- k* {7 p! i! F( e8 |
{; Q4 }5 ^0 m# K5 f# j S, t5 H8 c
alert("重复密码与登陆密码不相同"); 1 q% H6 d, ]9 |6 T, U8 { h
document.sform1.password.focus(); 3 \: n5 N$ r/ s
document.sform1.password1.focus();
* S6 T3 {& A0 k) o7 Q: r0 ^( U# { return false;! w' m# X6 u, t$ Y
}
& W5 N! m# k: U) X8 M2 n% V! Oif (password<password1) / F% N& y: L) m3 f
{, p% l# {" y1 ~: W
alert("重复密码与登陆密码不相同");
o/ o o6 O4 L( l document.sform1.password.focus();
3 A; E( I1 U$ f6 B; F document.sform1.password1.focus();
5 ?6 d/ R' r$ T4 R2 F% Q: _5 ? return false;
0 q, ^/ B& U% F3 e! q# O6 d }
" m- G) q2 H& L1 W) p! {) p' a if (document.sform1.email.value == "")
X4 }) p2 X& o7 w2 k {
* \# f3 ^* I& ?+ D/ s alert("请输入您的E-MAIL地址");
5 x0 `" S y: \- Q) _- x) f% K document.sform1.email.focus(); 2 ~2 l( E* j4 E; T: E: C
return false; / b, b: y4 f1 q$ _, Z9 N
}
( ?: o3 t' R3 M 8 ` N5 R( F) @
email=document.sform1.email.value; ! v- ` `6 w: i. i+ e
emailerr=0
3 ]( C( ^5 q. [$ K+ e. u! s for (i=0; i<email.length; i++) 6 C9 y- [/ t) s3 g7 \( A
{ 0 V g8 z' U) r* D6 i. I0 p! m& O
if ((email.charAt(i) == "@") & (email.length > 5)) 0 L- i- m, Q' y9 V% w; E0 h
{
" Y7 i, x: N. B+ M7 Q* }0 a9 q' y: N emailerr=emailerr+1
) D$ ^1 Z$ Y: v" J7 a% W }
! m; _) u2 j3 S2 O }
: l+ Y8 T: j5 D) G/ | if (emailerr != 1) $ C6 V s* D' Y+ x8 u2 Y1 e3 w9 m
{ - y5 G7 k/ {/ m/ ^! w
alert("请输入正确的E-MAIL地址"); 5 o( @% Y' l# E$ g9 x4 |
document.sform1.email.focus(); , Q2 q* G5 W# N4 {2 }4 T, z& p
return false; / [3 B6 g- B4 |% s& D
}
2 g+ [( ^* i9 G% [) c$ N9 f
, O& v. T% r+ B if (document.sform1.checkask.value=="") ' `) z% b+ u( c
{
* {' P6 c9 \: i U2 c6 m. T! J3 ^/ o alert("密码提示问题不能为空");
: p: d' ]' U2 P) \- W document.sform1.checkask.focus();
2 g# R9 e5 ?4 L" ]8 F5 D9 o/ _ return false; . j' L4 [% Y) x/ C6 q1 J+ j5 _
} ( Z% G- S3 ^6 D6 t+ l2 `" C
if (document.sform1.checkans.value=="") G* v: T& V5 g& ]
{
! F& _9 E7 S; L3 X- o4 g alert("您的密码提示问题答案不能为空"); & O/ p( ~' N5 S9 p9 a
document.sform1.checkans.focus();
& ^9 V# h+ Q& `* K4 J return false;
+ }) F. ]- M& ^1 h$ \9 B! ~/ m }1 A4 h' p8 t/ p# C. u% \
return true;
( L h9 i$ ^* G& ^6 o1 P' V j ( F% P# O; A) P* |
}
6 Z g7 z9 l9 r( o, A; z</script> |
|