|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
这个脚本对你可能有帮助:& r* e+ `& j5 [; k
<script language="javascript"> [9 ]# i( T, F$ x2 m; [
function IsDigit(cCheck)
; Z2 O3 ^/ m/ |# I" F {
% l$ R9 k: c( _& E return (('0'<=cCheck) && (cCheck<='9')); y. s! I7 r" ~ x2 E; o) ^8 o
} ; G- b. |1 v# i" | Q, [- a
1 ]: ~/ I/ q; |0 zfunction IsAlpha(cCheck) , e* h- @9 \) x4 V7 g6 T$ D
{
* \; M: ~' h! t. _. F return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 x4 A7 U( j) x$ V$ v# ~3 P
}
2 m, z6 B6 X/ S' G* k" O
, J6 q3 | r" |5 L7 @4 _/ wfunction IsaNull(cCheck) / l/ E2 _# W& E! G+ `% ^5 P
{ : g: j6 Q8 a2 ?- k
return(cCheck != " ") / {) \# _; ?+ l: Z
}
: [0 H5 x1 W% ~, }2 W. A, B3 _
* }6 e& D+ v* x* s2 e) f1 Dfunction checkform()
3 Z7 D- u4 U$ L8 p& }' x$ I{ : I( m0 M G1 d1 |) |5 d. j
id = document.sform1.id.value; 0 S5 H- W0 }1 T0 D' _& }5 l; [
if (id == "") 8 q8 N6 F) P# D! e
{ # \& o1 A( q |% Y3 g1 e1 p9 V5 B
alert("请输入注册名"); * X }' D/ Y) `6 Y0 Z
document.sform1.id.focus();
) f, C; Z9 b; V; s) b return false;
5 X9 { T4 t3 F/ o( j, ?5 O1 P! ^ } 0 ]$ ]) M [& j" {; A6 o
! k# `: A2 l" {" H2 ?
for (nIndex=0; nIndex<id.length; nIndex++) 8 @+ |8 V+ R+ P4 m! P
{
3 E5 Y, ]+ ^7 }6 ?6 Q& K cCheck = id.charAt(nIndex); ( n/ p! P0 r" L' C' w: S/ }
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
; y6 W5 Z. S! D { 0 } y: e) W J2 o! X* t+ K' g/ w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) p) `5 e, M9 ^% `- m! i6 Y document.sform1.id.focus();
: S' q. R9 @- ~ return false;
) x1 v4 p) X; U2 N5 X' z3 L4 b }
& f. H( `8 o p. { } ) D- K* d7 I" p T0 I& u5 l. {
chineseid = document.sform1.chineseid.value; 8 u6 u4 T5 B+ h
if (chineseid == "")
r5 Y, q1 L @9 J { 6 s* X- Z3 h+ ~( s" u$ {, |9 C5 m
alert("请输入中文昵称");
" | A' E% R$ ^ document.sform1.chineseid.focus();
& t, \& W; x- P- K+ O7 [; f# u return false;
7 ?4 |7 _$ x& `/ { }
( o1 H$ U' f/ ?/ c- L# h' m password = document.sform1.password.value; G9 T$ g1 d) j$ ^4 z/ {2 I
if (password == "")
. T+ v |& a) U% T$ k {
) ]% _- m5 k; Y# a0 g alert("请输入登陆密码");
- j6 j% |9 Y/ T/ \ Q) A document.sform1.password.focus(); 1 ~* l1 b2 r5 Y4 R. ~. h: v5 W
return false; $ T8 \1 ~* }, e( q
}
+ G @* z7 \# C# V4 C$ K- x password1 = document.sform1.password1.value; ! [( h0 M7 S7 [4 z+ W7 [4 }1 S
if (password>password1)
8 {+ x2 e, K) ]; } L: ]9 ]* g' J {
! v8 e' n: ?! L2 t alert("重复密码与登陆密码不相同"); 9 a7 Z$ b3 e2 D
document.sform1.password.focus();
$ M$ g+ o0 C; P3 C document.sform1.password1.focus();
. S3 ]" @1 V1 L" S3 w! e return false;; P% t& q9 ?/ { H8 Z' v$ o7 D
} 9 i9 R2 O2 F+ x: H! g. H# R
if (password<password1)
" l( Q) Q! W- a J1 R' Y' f4 } {
! l; ]' ^9 R! x& e: R1 { alert("重复密码与登陆密码不相同");
3 B, G2 \ v+ _- ~% d5 c% \; c document.sform1.password.focus();
7 r1 x- @/ o( w( w$ B document.sform1.password1.focus();
8 V8 G/ q% K w; H5 u return false;
$ [" d9 U3 K3 Y( S: x }
2 A4 f8 ~% L& ^8 ]8 h; k* P if (document.sform1.email.value == "") + \& P7 x9 R% u' w, o3 l
{ " j0 J; ^5 {5 G! g) h
alert("请输入您的E-MAIL地址");
E+ Y% D. j' ^) y: `: }5 ` document.sform1.email.focus();
9 X; Y- t% h9 f, L return false;
W) @: S& g, g! e9 g1 p8 k }
( K6 D, O/ X* H
# O- |* B% |1 | email=document.sform1.email.value; 7 m9 D+ a- j; l
emailerr=0 ; U* G4 [! B0 q
for (i=0; i<email.length; i++)
+ s" k0 t3 V4 l: M# m { : p3 N9 `# V6 [. O% Z ?% J6 z
if ((email.charAt(i) == "@") & (email.length > 5)) 2 U5 T6 j7 [2 k% z! Z, X! a7 V/ T
{ # S3 O6 ^8 t- J- N
emailerr=emailerr+1
* D6 O1 v0 o; _& \ } , e, K- P$ d H$ w4 W% A- O6 A/ S
} 1 `6 n. k! n2 C4 n& f7 U
if (emailerr != 1) 4 \4 }+ e* f. `. _! A
{
* F7 K, Y" `+ x9 p1 Y alert("请输入正确的E-MAIL地址"); ; G9 ^; T1 [! ?
document.sform1.email.focus();
0 J7 F+ e) c, Q( E$ z: F- {3 W return false; ( f; m) c7 N: [ t. r: P* M1 M
}
, W" O; q; s x4 q, S1 g
* ]( r; \ _ u, s if (document.sform1.checkask.value=="")
2 Y5 ]. {) v4 X! u: S" X { # E- U: x0 G: |+ i# ?5 i
alert("密码提示问题不能为空");
2 x6 B2 t g Z) g& d; M, k document.sform1.checkask.focus();
3 Z! C. Y6 a0 U return false; 9 t- h4 H" O) n: g
}
, m3 N4 x6 B% M" V9 O! X# ?' \, s if (document.sform1.checkans.value=="")
: _# L5 M2 G3 N$ P' |# T8 } {
+ k8 y1 L: Q0 T' r4 B) ^ alert("您的密码提示问题答案不能为空");
9 u. j3 v$ ~9 U/ w3 N1 }; l document.sform1.checkans.focus();
- Q" z3 [# l ]" K3 S1 M return false;
) V+ g! R5 s8 ~/ q7 b }
0 S$ A( Y0 g6 \7 J return true;
, ]9 \" X. }' c+ ^
/ u7 i/ H1 a+ C}
# R5 h1 X) z, B+ q& B8 L# a</script> |
|