|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14383
- 金币
- 2477
- 威望
- 1647
- 贡献
- 1425
|
这个脚本对你可能有帮助:" n* x" o1 u2 G0 l, |! D( g# @
<script language="javascript">
I. ?5 S5 E4 ?6 P% W8 P, jfunction IsDigit(cCheck) ' a8 {# d) d: ^, b
{ 8 Q! g7 E! M% w) X. ]& m8 B2 W
return (('0'<=cCheck) && (cCheck<='9'));
) ^/ `' X0 a, {9 ~# T } ) T) O3 q7 [# O L, o
- t, I Z% {! g# ~; R% }/ Sfunction IsAlpha(cCheck) ' x+ D7 w- U9 h% ^
{
+ e1 G- n: T" s9 a/ M8 \& W return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
( U6 [% V; N8 ^0 W7 B; ?/ ] } 2 R/ j' Z' C0 W2 n' T, c- {8 _' N) _
6 L/ d. s/ n y+ M* B$ q
function IsaNull(cCheck) " |" S. o: l; d( |; R7 D
{ ! b. I; T1 N$ Z8 I
return(cCheck != " ") " M& b. S4 h4 [# y: ~" K: W) N& t
} ( j7 m. x H9 y9 i$ _/ ^) i
3 Q$ y. i& v8 Y8 O- L
function checkform()
; m; d2 R8 m+ r* G/ M{
3 p$ W: g1 @' }1 p; E% Z id = document.sform1.id.value;
" X6 o3 E( ]& B if (id == "")
. [( w! A# J9 E. e* C { 2 f- i S; j/ A$ j; r
alert("请输入注册名"); % e& y d" u: m; g5 a
document.sform1.id.focus();
% _: {" Y# @5 {! | return false; + v9 L* m1 h9 L& t
} , Z0 Y* {4 q9 y
4 R F( |4 B$ p1 d
for (nIndex=0; nIndex<id.length; nIndex++)
; v2 a$ \, k) E, J7 C% u+ |: Y {
5 P6 U# K' G7 _7 \2 D0 Z1 e- G, z cCheck = id.charAt(nIndex);
5 b, ?# B% p4 }$ G0 ] if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
R9 ~3 x1 z' x4 {! B% V# c { ) }( X( a8 [. v: o
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); & H# [( N, Y6 \: i
document.sform1.id.focus(); 6 a# }: Q+ U1 L1 i& h- m& [/ H
return false;
. N( v$ ] h% R; l; D( K7 B } ! J- D6 K1 m% K% O+ t- l
}
G9 N+ D7 Z) ^' V' Y* u, m! _ chineseid = document.sform1.chineseid.value; 7 ~2 v5 ~5 x. z1 U2 g; _+ V
if (chineseid == "")
! b# M: ~! O+ w7 Q- O7 N( b { # R0 v/ u; {* t; {% i4 Q3 i
alert("请输入中文昵称"); : A4 r$ G4 k( A( b/ J! M1 _
document.sform1.chineseid.focus(); 3 b9 Q3 |% ]# m) f+ J- [
return false; : |' L! X& K6 [5 Z+ d7 N# W
} . m5 B, K" n3 R) V/ F, K
password = document.sform1.password.value; # q* a8 L. x8 T7 V$ I8 C1 T
if (password == "") ; J$ `, k k% M2 V9 g, G
{ ( ~8 h/ f* v3 | P3 a7 ^
alert("请输入登陆密码"); 6 Z z9 P* n% X% u
document.sform1.password.focus(); 7 T) r$ g+ D# C2 x" v4 P1 l( U
return false;
" ^2 p P8 W ]' v: ~ } ! k: I7 u6 V( x# g1 Q0 n: r
password1 = document.sform1.password1.value;
2 r" g% f/ r* `; O if (password>password1) ( Q" @7 s9 y5 I. t7 z
{
$ ~7 t! }# i0 a5 E8 X1 H alert("重复密码与登陆密码不相同");
) e" o6 X5 y" M) X; p. R document.sform1.password.focus(); # v; |1 K8 } O3 r
document.sform1.password1.focus(); " a# n6 m9 A( f9 F4 n: I0 g( j
return false;
6 z2 W) k% `4 j& f6 U } % e1 O) G# D* a" i2 S. w
if (password<password1) - V& ~$ [& H- P% N5 t" k1 b7 [$ \6 v" N6 U
{2 A! {( @' p V$ D& G& |
alert("重复密码与登陆密码不相同"); ( z$ |2 @7 A+ w2 j! V7 f
document.sform1.password.focus(); $ x0 {* `7 Q( [: V
document.sform1.password1.focus();
- t8 @0 y3 P/ y4 ?* s* V8 M8 ` return false;, i$ A | D& Z6 A
} ( g5 L" o, F: M" X8 @- o
if (document.sform1.email.value == "") % Z. i. q* m# K8 ?0 Y2 l1 e& F
{ $ p- S5 P# z( G; y% w# ?
alert("请输入您的E-MAIL地址");
0 q, G3 Q: [- ] document.sform1.email.focus();
, s# T- ~; j( y2 N) | return false;
* E* l2 i4 o7 ^" B. R) r, P2 K }
$ |5 ]6 w: y; P3 U+ Q * a' }' G! o, `9 C
email=document.sform1.email.value; 0 _, b+ R$ h. L3 n U
emailerr=0 $ p( ~ H4 M. W9 B" b+ e D
for (i=0; i<email.length; i++)
6 T' f$ s& Y* t, ^- O5 W { ' ^, {- D& p/ [4 J; l
if ((email.charAt(i) == "@") & (email.length > 5))
3 N! N/ ~6 ]7 L3 q5 y8 U @! b2 y { 5 j' L0 y/ h( f, u \$ h6 {
emailerr=emailerr+1
. w, k: A& ]% b; ^- _ } 2 z" t! `/ T' u9 C9 r6 j: N
}
8 s4 ~+ R6 [) ]2 F0 l9 j# { if (emailerr != 1) 0 n( c2 J7 o- Z7 {
{
3 X, w6 l; D% L$ T: N( I6 V alert("请输入正确的E-MAIL地址"); 5 X) i1 p1 V' |
document.sform1.email.focus();
- A# d, I# @# e3 N5 | o/ y return false; " O& m. ^# k9 k7 x* V. h
} ; r5 [6 P+ u9 ~, H! K/ l7 G8 E
0 s( w" t' y1 h' B8 z+ V# E if (document.sform1.checkask.value=="")
: I- p& n; [) v$ y { ; B; @8 O% H9 j5 i3 |
alert("密码提示问题不能为空"); * P0 N6 b: Z& O/ m. s3 S: Q
document.sform1.checkask.focus(); - m. O9 `( d& v& x' K/ a
return false; T8 a8 D; k- w7 C3 ^3 l
} : A- R( o7 O* E8 q
if (document.sform1.checkans.value=="")
: |. o4 X# `. t/ O; B* |: ^% g { 3 [: B+ @$ k2 \. z# n2 ?9 d
alert("您的密码提示问题答案不能为空"); 9 F+ |; O% s/ I
document.sform1.checkans.focus(); % ^" }% z% A9 O) Y
return false; % Y7 K! i. t- q& `# [3 d, n3 O. i* a
}
# s; u+ n8 T9 w5 s6 j1 j return true; 3 a9 y5 _% ]7 {5 X% J
. ~8 k9 L/ K6 t7 y( B6 H
} # U5 J) Q- U" D! A& j
</script> |
|