|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
这个脚本对你可能有帮助:
" f$ H, h6 y/ p4 l/ W# s- W<script language="javascript"> * Z9 l, ?8 M4 ]0 d" d. n
function IsDigit(cCheck)
6 L9 M+ t7 R! @ { 5 u E$ i3 _) U
return (('0'<=cCheck) && (cCheck<='9')); - m4 t; m e- L+ ?! V# u+ t
}
6 [: P! o- L; g% U# v* s
5 s+ [9 z# v; K! ofunction IsAlpha(cCheck) 1 R( j. A6 I; Y* Z9 H" H( k
{ 4 h5 m' u) m5 O
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
2 a7 B$ O$ ]3 N; b }
y( Y) r! D9 \) W1 m# y. ]
6 b/ |" d- b* O& nfunction IsaNull(cCheck)
; ~. u1 y2 `) [& @' M {
) s3 f! J+ j# v1 r- v P return(cCheck != " ")
% L+ i: G- V8 W9 u5 ?6 v& e }
& i' g+ n# [( }$ Y9 A9 O : P- L8 q$ C8 x; B" u
function checkform() 2 u4 {) r! D2 C8 z. h, [
{
" a4 [8 P& B7 f, Q id = document.sform1.id.value;
8 ?* ^4 W5 @' P0 {/ a; k2 d if (id == "")
( T4 G" z2 N- Y9 u" z { 3 ?" x3 T4 b0 ?6 M2 z4 c0 l
alert("请输入注册名"); 5 w, g: t' G/ p, N& \; T: H2 v+ R
document.sform1.id.focus(); 2 k7 u) Z# I$ S
return false;
n% l! P% q O. k; v3 s" V, c }
( l+ S$ W9 W( w. n) h% l9 ^) J ]7 Y* ^% j. q9 ~
for (nIndex=0; nIndex<id.length; nIndex++) F9 ]$ z0 {2 g. S) c! n E& y
{
) P m+ I% ~4 _, c- r cCheck = id.charAt(nIndex);
9 V7 [0 x# k& P; ?! m! s) }1 A if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' K7 ^; b4 t0 `5 I { 0 o2 n9 W9 K- B/ B5 w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
3 _ d, ~7 y T' m$ ?/ o document.sform1.id.focus(); + \/ Y3 b7 S E1 W
return false;
9 V2 a6 \; |& r4 h5 t" y- J. c7 R5 W }
- N# `; O* f; N3 o* G$ H }
) n, Z% w# |/ j" l- L chineseid = document.sform1.chineseid.value; j' g) V5 w7 k2 J2 O
if (chineseid == "") $ W7 B( Q0 F/ c6 _# F, V
{
# P: s. h3 W0 C; x d5 m6 U alert("请输入中文昵称");
/ h" Q) [7 V! b" X$ G, c: o document.sform1.chineseid.focus(); 5 u3 F$ u- j: w' {1 c; W
return false;
8 y, B) y: F, x- a } : x( B1 G' ?; n9 D" K
password = document.sform1.password.value; ( l5 S n0 I) k+ ], @# M" F* G4 Z
if (password == "") 7 E8 \( ~; G, e/ @+ N6 ~9 |
{ $ x5 z, Y8 l0 e3 r% |: H
alert("请输入登陆密码");
+ G7 z; t# M! p& p document.sform1.password.focus(); # d0 q$ l& s8 I8 t
return false;
4 v6 h% D5 N+ [0 W% D" B } ) E7 ~8 R J, n
password1 = document.sform1.password1.value;
2 D0 Y/ m7 u# f/ { if (password>password1)
1 b Q- v% a# l- V {5 O Z2 _: X) m/ u6 p k5 Q; e( E* O* F
alert("重复密码与登陆密码不相同");
6 t* E; J5 V( W& q# E document.sform1.password.focus();
% G- L5 }& A, Y* V- _7 w document.sform1.password1.focus(); 0 O& T5 W" b' R9 {: k' l
return false;
/ B) l3 z: K, @ } q" W# g4 J3 r
if (password<password1)
2 f. f( P9 n5 k1 g* O {$ x- a) A0 K! J6 v. E
alert("重复密码与登陆密码不相同"); # U9 g* B/ Q* V) z
document.sform1.password.focus(); 9 f' n9 V5 l' _% l
document.sform1.password1.focus(); # V/ Y; T9 _- I
return false;
4 `$ X1 u$ ]5 O3 W0 n8 X) [" r% P2 ~$ K } . `# l, X; M) k& D4 D) m
if (document.sform1.email.value == "") 8 l+ P! n" q( Y1 `
{ / Y4 v/ E9 A0 n+ N
alert("请输入您的E-MAIL地址");
8 X' q, G. l2 @/ ` document.sform1.email.focus();
" F4 u4 @, U. P% h% u1 p3 p5 U return false;
. l, D- Y! i n( K } 9 Y& S; z% `: g7 Z
+ H( b+ t: h* h( m! ^( S, ]
email=document.sform1.email.value;
/ N4 P1 Z( @9 |+ w emailerr=0 & c7 q4 i0 s8 A) u* j3 I
for (i=0; i<email.length; i++) / `+ |5 r6 q3 M
{ + B ?( _) _# w# e
if ((email.charAt(i) == "@") & (email.length > 5))
! M! a/ g' g; @- |1 ^5 d8 d) V { . g1 U9 ^! H1 d! D1 v" K0 j+ P
emailerr=emailerr+1
. H; e! q& K0 n } ' w8 I z; x) G* ^
} ! t- m# o0 d9 ?4 R9 c
if (emailerr != 1) . Q# l& F$ M1 ?
{
( c3 P* M% t. w( ` alert("请输入正确的E-MAIL地址"); 0 \" f: R5 ~# P7 U, Z8 r+ D0 g
document.sform1.email.focus(); ) X& R0 p: ] ~) K2 [
return false;
h) u3 d. Y2 r1 S+ i }
8 N' N$ U' ?9 [+ q
% a; h: E5 i. B% i6 t w if (document.sform1.checkask.value=="") 0 u O8 C# [* y* p9 `( r
{
6 @$ y- {8 {: k+ T% |$ Z; x alert("密码提示问题不能为空");
3 W$ U& h0 r& e% F. ~ document.sform1.checkask.focus();
! |4 q, }8 K/ V2 E return false; ], J! G6 G! U
}
: I" q# k0 E9 T# T# @9 X# n7 D if (document.sform1.checkans.value=="")
+ U6 z( w% p) s$ x0 a: I$ H { 9 y1 Z8 x8 X; d4 H# `
alert("您的密码提示问题答案不能为空"); ) s: y5 } p( w, _& J
document.sform1.checkans.focus();
2 m9 A9 r3 R0 x, m return false; ! k5 U: F0 ~ {! r( z. q, F
}
9 P! [4 T( a. N7 a# `" J0 d/ M$ l return true; 9 B% s+ g7 Y+ R1 V
3 S1 M4 A% ]5 n! U} ; j9 I* n* O% }& V6 W" ]6 `! _8 D' U
</script> |
|