|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14423
- 金币
- 2497
- 威望
- 1647
- 贡献
- 1445
|
这个脚本对你可能有帮助:5 ]+ H4 O& S3 i
<script language="javascript"> 0 M" f. b% r2 p' L" Z
function IsDigit(cCheck)
6 P* R+ D/ p F1 r g { % ~9 A5 n3 {$ m) p& m. f
return (('0'<=cCheck) && (cCheck<='9')); + Y" O1 Y9 @6 w2 F
}
/ X, P) S3 Y# q+ Y) @
9 m& F% A$ t' ~9 H M3 |* Efunction IsAlpha(cCheck) - E8 E0 G. j; F8 y- z" Y" Q0 F6 e
{
( _8 L# Q3 d1 P return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 8 B% x/ J7 _' G( i5 g
}
5 \' m9 m6 j) E & ?9 G! [0 e# ` p% _, P
function IsaNull(cCheck)
0 I( w. a2 |1 U4 l* P. I& A { 6 B1 b: }( \3 t( W I
return(cCheck != " ")
$ j$ c, z" G! a* H }
. g8 B# {* g1 [4 s # z& l* e: J& O p: _
function checkform()
8 N& g$ ]: t Q0 p n{ o+ g0 \% i$ ?$ W0 }& [
id = document.sform1.id.value; / K0 W8 L5 o/ D+ F
if (id == "") 4 M: s, _! e6 X3 S* V1 ^
{
: v, Q+ O2 @, J8 x% p+ j alert("请输入注册名"); - P- J7 U; D* F$ R
document.sform1.id.focus(); 6 l! E2 q6 W ?) f
return false;
4 M* _5 u" R* R5 Y# O( ^ } ; g. b3 F$ f2 l7 e6 ]& l# H
4 _2 l/ U; r' @ for (nIndex=0; nIndex<id.length; nIndex++)
+ s1 n/ h9 g: E5 B, _$ ^1 M { * _6 m6 z4 q2 y2 E
cCheck = id.charAt(nIndex); 2 ~/ K# Q! Z. h5 V, I7 W1 N
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) + `& f; L9 T" C' }9 G* }
{ 9 t$ |+ _: c1 `
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : V# U: R! K* I( K3 [, a
document.sform1.id.focus();
% ?* P3 d6 |8 m# u' x return false;
& L, ~8 }" v+ c: r- g }
1 h. D! ]( C6 c; U; f } 6 p5 ]7 L! `1 z3 Q( r% K9 Y
chineseid = document.sform1.chineseid.value;
1 h ^7 P3 k8 ~( l if (chineseid == "")
p7 ]- E7 X) s0 L: j { 9 O: v( X# T# ?5 u! M7 b
alert("请输入中文昵称");
: E- h0 _$ h X' D) y: S document.sform1.chineseid.focus(); ' A E: V7 S7 G3 F2 D; b8 h
return false;
3 \- Q6 Z! d8 r- Y2 g9 I) g } 3 |1 T K! I8 j. s
password = document.sform1.password.value; : s! k0 L0 q( D
if (password == "") : L' t4 x/ G9 a: L
{
# ^9 ^1 B7 ?4 ^1 P3 Y: x- ] alert("请输入登陆密码"); ; C. u& P" u' i+ V
document.sform1.password.focus();
i& g4 o# b9 }. }; E8 G* u return false;
7 c! Z& U s/ d } 1 l$ l: E4 ^7 f5 B! K! J; e! p
password1 = document.sform1.password1.value;
6 I O7 f% w: N D |" q4 m1 ~ if (password>password1) 3 h# p- d9 x- p1 K9 |, s
{
8 g3 s: A: v4 V3 o7 V; z/ i9 w alert("重复密码与登陆密码不相同");
8 b7 V, w8 T& ^, e+ ^% k document.sform1.password.focus(); . Q& r3 \# A0 m6 ?1 f% _3 @4 }
document.sform1.password1.focus();
r1 p. Q5 V$ f: r* K* i j! y return false;0 s0 X2 v7 ^! ~6 W1 z" l/ ~/ h
} . Q+ m6 t- z8 e, V! O% _% H# t. N9 o
if (password<password1) % H6 D8 i8 t( z1 J, |0 m8 F
{& n% d5 m! p" w" K& d, i
alert("重复密码与登陆密码不相同"); 5 {( m" o& q$ g2 G- q) A Z& J
document.sform1.password.focus();
: { K4 A+ O) k; W7 b! p5 y document.sform1.password1.focus(); ; ?6 R. W# n9 @9 w. _
return false;) P' h" i* E& M
}
% p7 e/ H8 v P6 u! N if (document.sform1.email.value == "") / `1 W2 S- ^7 W! t! ~( K1 {# k
{
- V; f+ y+ p# \9 P! f# q8 ]* o alert("请输入您的E-MAIL地址");
0 l2 ~1 M7 b9 K( o( g0 Z D document.sform1.email.focus(); 6 J/ u( }5 C+ M F' y$ F8 |
return false; " k2 i% A; X. q$ q- z. H
} / G' H. o4 J- [5 u
0 E8 q5 M# g, s email=document.sform1.email.value;
& j$ }- b4 G5 f; Z emailerr=0 * [! i$ O$ t$ V* t+ A7 c% [6 X
for (i=0; i<email.length; i++)
* l8 g0 w! J$ y$ ]0 m; E3 l+ P {
1 y' L1 K3 a5 `, y0 O+ g if ((email.charAt(i) == "@") & (email.length > 5))
- c) O( i' n: `' o* u# R1 p { 8 p R( S+ i* l2 A- H& R
emailerr=emailerr+1 + X/ R# a- b1 V% m2 G, [
} 6 o! ^2 K E7 q v$ d, j
} 3 ?/ N+ @4 T/ U
if (emailerr != 1) ! ~" t2 b6 H( a8 @ L5 w* {
{
/ R! ^% [* @0 x6 V alert("请输入正确的E-MAIL地址");
. A+ s4 |; o, v) a document.sform1.email.focus(); # W/ k& A9 ]5 \; f5 T7 P# D
return false;
+ ~# z8 j6 E0 `$ ^3 A" M' p& t0 L }
% G8 ~! w1 C7 E( i2 d, {: b- @3 [9 ~
' l0 f* w: N( v/ k if (document.sform1.checkask.value=="") w' ^6 {0 x$ I+ `% F
{ 9 A v; S( K5 ^: F) S
alert("密码提示问题不能为空");
% l. a3 m6 T. [0 v/ @) s document.sform1.checkask.focus();
B: Y7 I. D' E2 o6 } return false;
5 \% T! r4 U% g" n4 B9 `6 v } . F. b9 T/ \, Z( R4 b$ N% d
if (document.sform1.checkans.value=="") ! j: k; l/ n% E( r6 j" d7 c
{ : c1 A7 s. Q8 h! L9 v
alert("您的密码提示问题答案不能为空");
" M" z1 G. b% U5 S1 Q! w3 R/ Z document.sform1.checkans.focus();
" N* z' a4 c$ Y2 G! H5 b return false; 5 `) y9 F# L# ^. R1 _
}
2 f; v% u; Q7 s9 A# { return true;
( m+ b! G3 O2 H; A
7 t" e8 N2 b6 B% [# S! X} 1 ?3 A$ @. h) ]
</script> |
|