|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助:
5 h# O7 \" t4 w<script language="javascript">
" Y+ {* x' q4 q3 w+ j& S1 zfunction IsDigit(cCheck) + r' V5 g' j5 [$ S, X
{ * S/ b( e1 W" S; k. A8 {$ x
return (('0'<=cCheck) && (cCheck<='9')); , E% r0 W8 P& S* D' X X* H n
} 4 p- q- e/ K" O
- R% `# h$ K& o+ tfunction IsAlpha(cCheck)
+ X) x3 R) ~& z3 } R {
/ o" p5 a! r. @$ m6 m; ] return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
2 R0 W' q! U" l- D! J0 M+ z }
7 _- B3 o! B. _, a8 O% }
- S) Q3 O* b) v/ u2 j( wfunction IsaNull(cCheck)
8 Q7 T# ^, U5 U6 ] {
$ l' W. A6 z) J3 e8 b; \ return(cCheck != " ")
' h5 G! ]$ N9 a% x4 d% J5 Z f! `" Q } $ b5 {1 Y9 _; n# b0 m
7 A1 q7 X$ a" f1 G5 _function checkform() 7 D$ Q# X% p/ x, E0 I0 ^- z
{ % U4 e' m+ M8 i, F& P% f" L
id = document.sform1.id.value; / |- d1 o" T- y. F ]- @
if (id == "")
: b0 t2 F* ]# R$ z { ( ^! q6 g, t7 J
alert("请输入注册名"); + p1 N" c% u2 ]! d8 f* V+ V& s8 C7 U
document.sform1.id.focus();
1 a& _4 A4 E: Z& c return false; $ ]7 I6 c" I' s0 Y+ E! w
} " h: F4 n3 J' O* o8 t
' r% E6 ]- x8 z1 O for (nIndex=0; nIndex<id.length; nIndex++)
% X* ~ a, J# q6 L' s) L8 j { - V2 _6 o# P" z8 y
cCheck = id.charAt(nIndex); * ]$ Z1 h* \) {' U+ a: q
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) - v9 i0 {* ^+ R3 t3 f# C
{ & m a$ Y1 ] z1 u# h5 J- a& y
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 8 _, f. j6 x- F$ T
document.sform1.id.focus(); 4 l: C" B- z: }6 b8 ^
return false; ; T$ A: j- A- a6 X) [1 G$ ?4 K% L
} % W8 s) p) N4 W o! b, G4 C2 o7 Y) ~
}
7 D0 t5 k ^( J$ } chineseid = document.sform1.chineseid.value; - W- Z e' A' A0 ?/ `' V
if (chineseid == "") , o) z5 {8 N' C8 Q% e
{
" P+ Q7 F/ _6 [ alert("请输入中文昵称");
/ ~! d4 K t/ @9 U4 `5 @- ] document.sform1.chineseid.focus(); / S. z! ?% V7 I9 v7 q Y, Z: y0 h
return false;
/ }3 t$ V; s; b8 Z- H6 a% L } 1 n$ L; s: L1 w( ^9 o: A
password = document.sform1.password.value;
) p* l! [1 p) g1 i( b4 d if (password == "") T8 `- }* ~6 ?' a1 n
{ ! J/ f+ J3 P8 Y# h8 Y: V4 Q0 y
alert("请输入登陆密码"); & u% b4 I2 f. j
document.sform1.password.focus();
0 ?1 `4 ]% e+ D) p/ ]% E6 @) ] return false; % @- h, e; d4 O1 ~# ]4 B1 `
}
4 Z# c- e4 ~3 C/ l password1 = document.sform1.password1.value;
# C e* e S4 ?' o* C, z$ K if (password>password1) , V- y* b5 g' G; a
{
. `' G+ M3 b# p* S2 S+ E- V/ W! J alert("重复密码与登陆密码不相同"); k1 W2 E/ E; B" G& H
document.sform1.password.focus(); 1 U, [- d/ z: r0 x
document.sform1.password1.focus();
3 d7 i3 n8 @; W4 o' D; q/ n3 U; s return false;3 L* [( L3 M7 s/ y
}
/ X: w. n' _) P; ^( |if (password<password1)
T1 C8 ?$ [7 \& k A; F. S { o/ B: Z$ y9 R H
alert("重复密码与登陆密码不相同"); $ C& y8 c' s' g& S& g
document.sform1.password.focus();
& m3 Z; ?1 x+ C7 h* a document.sform1.password1.focus();
" {( m8 J3 f, D) W return false;# g6 u5 W7 B, a& J/ m: A7 {
} 1 S; e |2 f" P2 f6 A
if (document.sform1.email.value == "") , {# k) X1 N! a3 a& i- \
{ + F, }! |6 Q/ l" h$ ?/ Y1 Z7 t- Q/ ]$ \+ y
alert("请输入您的E-MAIL地址");
9 e; R D- y) }: e document.sform1.email.focus(); , n3 C! J# {6 C1 z3 ]* m
return false; ( M" ^$ {; E) B6 l& L
} . K. }6 ]3 o1 ]# P v( [
( L( |$ I8 ]. |/ m; s
email=document.sform1.email.value; 2 `) n( X* c# d' T% x' V5 e
emailerr=0
0 i& O4 ~2 J6 X, j for (i=0; i<email.length; i++)
: U: x3 G" f/ @ {
/ E4 z) t/ E9 g/ l: T if ((email.charAt(i) == "@") & (email.length > 5))
9 U+ B% u. Y. b# E0 k/ y' O- I {
+ {4 |, o- v3 N0 j emailerr=emailerr+1 & O+ W' x9 n- J
}
0 j+ t- G+ Z" m' j7 E/ m8 w) o5 j& W: @1 o }
6 N i9 I- D% s' R* m4 r if (emailerr != 1) - \, r1 }, \$ x* {
{ 1 W& N _1 X/ u: _$ L
alert("请输入正确的E-MAIL地址"); 7 T8 l; D" e/ A' C: ~
document.sform1.email.focus(); ) c" E. Q) m1 F
return false; ; _0 `2 G+ r# o0 F7 }
}
+ u" m' f$ Y& o, U* c9 ^" | ' G) s' V1 w0 ]+ C2 T% a
if (document.sform1.checkask.value=="")
- k m9 b$ c# R% s. D! ^$ R {
f* s3 a% |/ U! d) A L9 f$ Y9 v alert("密码提示问题不能为空"); : Q3 U7 N* `+ b
document.sform1.checkask.focus(); 2 E% Q1 ~% p1 n- X' Q* v3 H
return false;
9 I1 T) Q* p7 {$ [9 O. j2 A+ f } 3 j2 ?" [& _3 Y* y* S1 c
if (document.sform1.checkans.value=="") 0 x" n& n( _' |% A8 Q h2 T, f
{ 4 l& t5 M0 L" i/ o' }- e# D1 v; w6 ?
alert("您的密码提示问题答案不能为空");
4 i& B$ [& i! B5 G) t$ \( p% [ document.sform1.checkans.focus();
. I. m5 f; T/ c2 N5 U, x E+ ] return false;
3 E; L9 o9 [3 L. L* v4 S$ N3 s }7 g2 e( j* b' z2 l9 e
return true;
$ d+ {) ]: Z9 M! M 3 ]3 V5 b3 ~ d( v) r) `
} J# Q- [% B' {, p2 u& L) R3 P/ P
</script> |
|