|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
: N; v. c! K/ U' ]. e# u r. Q<script language="javascript"> + H* O7 [. q" e H2 z+ A9 d
function IsDigit(cCheck) + U! B% q7 S3 Z( D2 W# S% A
{
. ?- |/ [9 e2 `7 q& R5 T8 h6 P2 I6 F& k4 D return (('0'<=cCheck) && (cCheck<='9'));
; R! C% a, F6 G: r' ?3 w G } ! x9 Z4 w" q! f
# E. `; k' ]9 ]5 _4 w' P
function IsAlpha(cCheck)
, a5 v: G% {, o! z1 ?) A/ O { 7 I) [$ V: g; j& T1 x
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ; B% w8 P6 P2 { E" X8 s/ P
}
, z9 W6 d: N: z$ m5 I5 b' J 7 d: @4 ]' j* R& B" j6 w" j) F- G
function IsaNull(cCheck)
5 `4 g( z% K0 m# C' t {
9 t- s% b! Y0 Z return(cCheck != " ") - _$ h9 v i% ]- Z O2 l
}
$ O9 l/ Q+ a$ T- o9 J - X1 ?) N5 s6 a7 `3 h: g; o4 T
function checkform()
. i- ^0 T4 l/ S+ ^{
! H4 O B* ]& \' A0 |4 i& Z! x id = document.sform1.id.value;
+ k- n6 i5 l$ ?9 n if (id == "")
1 _3 _- s( }6 X- ?$ [1 {6 O1 A9 w8 m { 1 v0 A2 ^! r, a3 r7 Q3 D
alert("请输入注册名");
3 r& E5 X9 k7 M% ^ document.sform1.id.focus();
0 m* P, F% q5 E8 B return false; ' \8 F7 X- @. a" T
} 1 {2 U8 a6 @+ g
. Y6 S$ K, Z, Z @7 b( r3 |8 K
for (nIndex=0; nIndex<id.length; nIndex++) 5 g. P$ P4 M# `4 \9 k0 a2 w ]
{ * A; v$ I* v/ n: q) U7 x6 V
cCheck = id.charAt(nIndex); 3 A6 \( Z! }3 O2 a
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' g U8 L! E+ ~ {
# K& Y! X, d" Q& F+ G) K. H: p' w2 l alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); " E& m; L( v# P: s
document.sform1.id.focus(); 5 I9 i& E5 o3 @+ [9 t2 u# i; P
return false; ; L/ G8 W: e8 h# [; a4 e4 _. w
} L( ^& ]- L8 N. s8 H$ p4 U+ y2 Q
}
% r* ^. \) u# U; l chineseid = document.sform1.chineseid.value;
& u1 A6 m0 h8 @. ]- | if (chineseid == "") & F$ L; ^! _8 V
{ 1 k* d8 Y7 \1 O( S& c2 z) i+ F
alert("请输入中文昵称");
- G" z1 G5 L, k- [; ?/ b document.sform1.chineseid.focus();
8 Y* ?$ Q o s7 y! U- q return false; 2 @+ S" E. y; q
}
. U, r3 _) @+ `" `* A6 x password = document.sform1.password.value;
$ x7 D0 W2 Y9 j. n if (password == "")
7 x! c( M# ^$ {0 C$ _. \9 k m { Q6 o5 D4 w3 I
alert("请输入登陆密码");
2 A- X; _" O% V4 D1 c D/ o' m# E document.sform1.password.focus();
2 q5 {& \7 G3 b0 j' E3 ?9 ~' | return false;
^( V* t$ ?) V, Q8 l1 k7 u; g } 6 x" |) [3 D0 u8 j3 y
password1 = document.sform1.password1.value;
: U6 i6 v- i# c J1 F+ g2 H if (password>password1) 3 O* p4 f) t8 H0 I7 \
{: N2 E2 U7 M5 g& Y$ }' P
alert("重复密码与登陆密码不相同");
8 g9 L" D$ v8 Z" g7 G" } document.sform1.password.focus();
; B# i Z' H. @& _ document.sform1.password1.focus();
& }7 q0 X: V% R return false;
. S! V8 d1 J1 y( }) g( z' a } * o0 @8 ~% n/ x: e# D
if (password<password1) / O/ x3 q) N8 e2 s' R/ v/ E+ i/ C( I
{
/ k/ v" k! l1 U alert("重复密码与登陆密码不相同");
+ y7 D( b. D+ e/ q6 D( j document.sform1.password.focus(); + _- Y. K c6 A+ R/ L. b
document.sform1.password1.focus();
) C# J7 H! h1 i1 D+ t K return false;
$ g: T3 W# V! \- |# ]) i! n } / h( L5 b+ {5 t4 k2 G3 L9 v
if (document.sform1.email.value == "")
/ U' _& k: z6 j5 a6 j { 2 E$ ^! X6 r% Y* ~/ b) n
alert("请输入您的E-MAIL地址");
$ X! V' J2 \$ H document.sform1.email.focus();
6 n. l; h$ `: _9 q. U return false; & d9 K9 s5 J. \8 I
}
# j/ V0 J' I9 f( s* n7 f& F . v1 X) t# S" P- d/ @% I
email=document.sform1.email.value;
M. H! }( Q! B( U) k* n# \ emailerr=0 6 w( N, ?1 p H- ^+ S4 G6 X
for (i=0; i<email.length; i++) 0 e4 S% j; i% E/ E' w ?, |8 O" m
{
: I# O K! X9 @. ~* o: g if ((email.charAt(i) == "@") & (email.length > 5))
0 Q1 f6 \' k% C! v3 y* A' p( B9 O {
3 r# [$ ]8 N& y7 s) y' x emailerr=emailerr+1
" ~' p1 o5 \( h- M' S- L$ V } : K, C2 h4 t& F
} 0 P, U- s& d8 T) X( V8 P
if (emailerr != 1) 3 s/ c( {, @( _ ?3 T
{ , {& w+ y+ }* z! ~- X
alert("请输入正确的E-MAIL地址");
3 e- V9 Z8 [' H$ T9 W: ?% y5 U/ H document.sform1.email.focus();
& c- a; D) q( G( O: ~ return false;
( H# m, v1 h8 F6 h9 S2 M8 b }
4 F1 l' P) S/ @* ^# n
: i5 C% d6 ^& K/ k- L/ R if (document.sform1.checkask.value=="")
: S5 }' ]8 P* F1 K. K+ u- U3 Y) F {
( ]2 c* n& w( L" M: p alert("密码提示问题不能为空"); . b4 v" |8 _% H' j& l
document.sform1.checkask.focus();
2 }7 G! Y- x2 d8 |- N& y return false;
4 Z I9 x6 E |6 k/ F1 c } ; D( y. Y) G) a+ f
if (document.sform1.checkans.value=="") y+ N' {" T% ?
{
: T' z+ q* q& C) \1 @) K: ]; X, E4 Q alert("您的密码提示问题答案不能为空"); : u& l* k4 s. B* |) `- g% Y4 W' b
document.sform1.checkans.focus(); ' Q+ A2 W1 E7 |5 u
return false;
5 L. N8 `- ]* l9 R2 I }% ^$ s Y9 A4 J) t- D
return true;
; A: k. V, X3 Z& F, U. D , n: d# M1 O6 M, y4 D
} ! `! _$ F! {& m. C
</script> |
|