|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14407
- 金币
- 2489
- 威望
- 1647
- 贡献
- 1437
|
这个脚本对你可能有帮助:
# l8 o7 z3 r- h5 C<script language="javascript"> , i3 b4 @& k0 q6 m( r Q! C
function IsDigit(cCheck) 5 ?+ g8 T. e [" X& A
{ 8 v' Q2 P$ {' p0 z; v
return (('0'<=cCheck) && (cCheck<='9')); ) A2 O3 D! |$ Q. Z0 L9 ^
} 6 v2 S' B4 ^" t8 a" y+ c" Q
" W4 n9 o5 d9 M' x1 B lfunction IsAlpha(cCheck)
2 t v, _9 p9 x# h4 X3 Y# ^$ y { " R) u0 a. f& y. l i- G
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 ~6 R! `# p) Z+ L1 r } : o# d: [6 H+ O7 W5 i$ j6 @
6 G7 R) |) s3 @
function IsaNull(cCheck)
8 }/ a1 I' m$ o: y: n. C6 o+ e {
: I% `3 n& o: P" w. z return(cCheck != " ") , L; \ X' \/ C% [
} ) a5 u1 I$ w. Y3 l0 n$ t' U) A( T
, A+ I7 L5 }/ A/ Q( U) z
function checkform() 1 O+ k Y6 @) @$ I
{
; {1 s- u& [6 g( L4 |5 f. _/ V- h id = document.sform1.id.value; ; `. K0 B8 v0 j! F. {
if (id == "") . J. e2 \- A+ P0 x+ Y, g
{ 9 T8 d, F& y; F: E8 |2 _, R) [) O6 o
alert("请输入注册名"); ' G" }2 J9 A x6 r$ P' G+ B
document.sform1.id.focus();
: [: s7 k( S+ [9 K1 N8 m return false; 6 Y) p( d0 p/ x9 P
} $ ]$ D( V9 C+ l0 A, g
) m! C# I: t" x. R& Y2 \
for (nIndex=0; nIndex<id.length; nIndex++) + y0 @% R: a% L
{
, p, {( E& r( ]- F7 m cCheck = id.charAt(nIndex);
_ I" O0 ^9 x( \; T {" h. D& G if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) & o& ~; E% {% W& }3 a
{
* x$ j {' U) K9 _) ]+ L8 c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * s2 o$ Q# |+ S- Z: q* m6 F
document.sform1.id.focus();
" t* N: Q, Y, m return false; + J$ E$ y* S! L0 a# I z
} 4 i5 d m$ N: |
} 3 D5 x' C5 W# w5 w* V
chineseid = document.sform1.chineseid.value;
9 `: d; X+ k4 C! u. P if (chineseid == "")
% U% z! _& f( R% A- I { $ ^" g6 e0 c B1 _5 L9 l" f& B1 b
alert("请输入中文昵称");
- \2 U6 m1 K3 T document.sform1.chineseid.focus(); # W+ M5 I" f6 L0 n- J" d' [
return false; & d* R, q# J. y- A. G; p( H! g
}
% E( D) e% r* p$ P* b password = document.sform1.password.value; 5 o% x P" h; y9 y# `& J" E6 k
if (password == "")
5 a" p/ a0 m! l% a- t i3 t7 ` { 9 X K8 b7 D' I/ A) s6 s- H! {
alert("请输入登陆密码");
+ L5 y7 \) q. r% F' ~+ [( t2 G document.sform1.password.focus(); # u" b) c9 F, n% w
return false;
/ r9 @% c! O. l, W } 6 A- X0 p+ U* n
password1 = document.sform1.password1.value; 9 |' Q& L1 H+ P
if (password>password1) ' g, P7 ~) k, ^
{: k# e6 X1 P( T9 N/ z6 t& B2 ^
alert("重复密码与登陆密码不相同");
* S" S: r, E" _# \+ ^& X document.sform1.password.focus();
, G; P# z# x c' _ document.sform1.password1.focus();
2 Q6 A4 ~# E; g- ` return false;3 Z% e |0 j2 D' w
} 7 U# U6 N; q9 C- E
if (password<password1)
! R* S" D1 W/ Q8 R! _8 D. x {
- F6 g+ f$ D/ M6 M: l7 N' Q2 j alert("重复密码与登陆密码不相同");
, J. g' n& ~* O* p document.sform1.password.focus();
; b4 f& U, |; S, |% R document.sform1.password1.focus(); ! v4 ~8 J2 v$ I( x3 k" |# J1 J
return false;
C" Q8 y l; r% f+ G7 g; w } , O4 k3 b5 H X
if (document.sform1.email.value == "")
- k3 h( |" F U" F' r: \4 r# b { 5 [0 ~3 O! d Q Z, o
alert("请输入您的E-MAIL地址"); ) T5 [( H4 k: `9 L
document.sform1.email.focus(); 7 o6 u% s. ]3 R
return false; 8 R- ` A2 T; ^' t7 } a. K
} # ^6 `( O, @+ G. s" c* Q
2 Q+ S3 K# G/ m8 c- m7 f
email=document.sform1.email.value;
1 R9 _# Y3 y# @4 ]" B# m emailerr=0
& A' A; r4 }5 [" d for (i=0; i<email.length; i++) % t+ |$ x, u9 {0 s' Q8 A" t
{ 8 J% R/ S4 x; c" i, r
if ((email.charAt(i) == "@") & (email.length > 5))
4 x( @" c& [' u% [+ Z { % O& }* o" g1 p3 O: ^0 G/ s
emailerr=emailerr+1
+ F. g, p. _, S2 H }
. z3 O( N2 d; m0 w. ~; Z5 U* v } ( t0 |( g: @8 M& g, ^" c7 A
if (emailerr != 1) $ B6 \! S8 T; J! B& ?
{
: c3 Q1 P) G. l' s alert("请输入正确的E-MAIL地址");
! J* Q8 C. P5 b8 G5 q document.sform1.email.focus(); * e& G& u% b% @2 s# e ?
return false;
0 C8 @4 U d( O# D+ `2 ` }
$ V8 o1 C! E$ K& [- p
4 A4 D$ Y: k8 L$ _4 X; c* m1 n2 G2 R if (document.sform1.checkask.value=="")
: N# Q o4 N4 S& z+ I: Z7 \: L { - d, o3 g0 j9 x B* s6 Q3 |
alert("密码提示问题不能为空"); , b! d& Y* m1 a) W& F1 d
document.sform1.checkask.focus();
n! ?7 I$ E7 I6 {) S" K$ T return false;
9 f( R6 H2 D/ S/ M2 I% Q6 U9 O }
7 |! I! o8 w% u/ d7 { if (document.sform1.checkans.value=="")
* l2 P; b' l! g- V1 @* B+ [ { 7 F3 J* y) b7 Z* W, h
alert("您的密码提示问题答案不能为空"); 9 G" M; _! D* q8 x7 u4 [
document.sform1.checkans.focus(); ) x2 T; d4 ~) N6 r U' F0 U
return false;
$ i2 L; I/ V" ^ }
8 i2 _5 ?0 @# G) n E u5 C return true; $ h2 S& S+ Q, D) c- y0 h
6 r0 y; i- b) b1 r& o}
/ {) c, M4 b2 H$ R% S8 Z4 x2 y9 V/ t</script> |
|