|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
这个脚本对你可能有帮助:2 q" X9 K* v6 [6 Y2 j
<script language="javascript"> 4 @6 N5 x5 O% ?
function IsDigit(cCheck) + A" G4 _8 o/ a
{ . l. A5 k' e: Q0 {3 S
return (('0'<=cCheck) && (cCheck<='9')); & E* H/ Z. o+ o$ ^ y- @ J4 p
} ! f* X2 ]* k: g) `! ^
7 ?1 y$ C: B& C0 P6 ofunction IsAlpha(cCheck) / h0 s* [: q& l3 D, J
{ W# s4 R7 k# m" w( o) J D+ e2 i
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 7 M8 p8 B& ]# r9 G0 n. @
}
! g; t8 b. Y! y( y$ H) \ 6 m! Y- ^: w# `0 S
function IsaNull(cCheck)
/ j) k% k& q# k { ; A+ L$ ]4 `2 F9 u
return(cCheck != " ")
3 z% a" J/ b4 I [* W* }/ H& f } * z7 S7 c) o/ [( x
% f% s; Q, A0 t9 H j, c* M- \# V0 c
function checkform()
/ i1 P K! n# p3 b+ v, G. W0 g5 T& G{ w' t1 I$ z6 ?$ S; A
id = document.sform1.id.value; 8 I# F! A+ {0 R0 B/ P d" B5 b) J
if (id == "") $ l3 v; s- ~8 a4 @ G2 B
{ 0 V3 Z& V% s3 R6 x0 Q9 B% g
alert("请输入注册名");
- r5 E! U* i: ~ document.sform1.id.focus(); * q/ ] P. ?# D- w o
return false;
) E5 g5 I- d+ p$ x7 f2 h! X& T$ T }
" Y5 p% g) n7 o% w3 h
( e% T) C' s* Z3 G! x( d4 H for (nIndex=0; nIndex<id.length; nIndex++) , ~6 m! S+ Z- L5 ]: g& e' G; ]
{ * m, S* P8 y- |5 h- h: I
cCheck = id.charAt(nIndex); ' S9 G2 W/ \9 F6 s5 b3 @" @* J
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) R2 u. n! }1 L, G# ?* o8 E- U
{ 4 C! b& H; [: z/ s
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ; q J" g8 p- t
document.sform1.id.focus();
* S- B/ @ k4 E \! w& K return false;
/ j7 m5 Q2 j! v } ; e$ h% u' k/ O) D& `1 v
} , [" r1 _- G( }+ ] V/ B. L/ z
chineseid = document.sform1.chineseid.value;
: M3 s* k) h" O# W) c: |: q if (chineseid == "")
+ a; e( t. m$ f4 T/ }( U1 G { 7 H+ E. M4 @. d x
alert("请输入中文昵称"); 4 P4 ~: u7 N; x" N; g; N
document.sform1.chineseid.focus(); ( R& w2 ^. C0 ]3 @$ D# V
return false; ! R1 p- p& @& u
}
% c/ _+ ~' P1 ` password = document.sform1.password.value;
) u b/ B+ s" B( Y5 i if (password == "")
7 |5 q1 P X- b1 n. L; j# V$ Y0 e {
4 i! ^0 o& e7 d alert("请输入登陆密码"); + Z% s7 Y/ y0 Q) R: C
document.sform1.password.focus();
$ Y" Y/ D* Z6 P" O return false; / T# X# a& S0 R# ^. g
}
7 M4 c& y" N: _7 ]" o! g% V password1 = document.sform1.password1.value;
" H& ~3 d v5 K1 P# _ if (password>password1)
1 v0 s! o! m# [; i; x {- P- ]8 p5 [5 f$ V
alert("重复密码与登陆密码不相同");
; n3 }2 c& B4 R- }; s document.sform1.password.focus();
4 V- c0 Q6 s2 U T, a# C document.sform1.password1.focus();
1 e& |5 i! G2 F return false;
1 i) y/ [. [9 S" s0 ? }
`; l L! U* C( sif (password<password1)
* Q) `9 i7 L* v4 [7 T {
; [$ f! M: t9 F7 x$ v) P; C alert("重复密码与登陆密码不相同");
8 {8 b3 Z% A7 m/ w; l2 q document.sform1.password.focus(); ( x6 u" R, m! L' X8 b2 Z
document.sform1.password1.focus();
, P9 v; d# F2 n9 a# J, ^/ K- A return false;7 g- Y j6 V, l8 _9 H8 E
}
8 A% D: } J- ^0 N' s6 M0 b if (document.sform1.email.value == "")
2 M4 Q( i( V; g; C {
. n1 \7 j- A7 ^+ b' t alert("请输入您的E-MAIL地址"); 3 u g/ ^/ l9 a, L/ G
document.sform1.email.focus();
& g! t+ u( \6 A7 ]5 p return false;
3 J) d: Q% p( d+ H. d1 M& u } 6 X2 ^* ~! F1 ?
5 O) I0 e+ y9 Y email=document.sform1.email.value;
3 f" F, J6 o; m emailerr=0 : a9 K2 L! Q4 {7 K6 { T' C0 \
for (i=0; i<email.length; i++)
+ _. B2 s+ V1 j) I# ` { 4 N% A c9 a6 q$ r, U) K
if ((email.charAt(i) == "@") & (email.length > 5)) 1 a" r; _: \ j/ u
{ 7 e' Y4 E, Z9 T4 b, @: c
emailerr=emailerr+1 * g* q3 f$ P) `+ |( `
}
; m) w) [- u- s: N% R3 _0 i } / w, u% \' M7 W! g
if (emailerr != 1) : ~; t" }+ |1 v2 K+ C
{
- l, n! J) M) I9 `# b alert("请输入正确的E-MAIL地址"); ! ]% n, p/ ^, x% ]
document.sform1.email.focus();
. M: ]! V! F% A. H+ | return false;
( L* ` y1 j7 J, L0 i8 p6 Z9 D1 i } * _& d0 F4 X! S$ `2 U4 K6 h
7 {! @) {5 |, D) R! i0 G6 I. ] if (document.sform1.checkask.value=="") , U8 w: I; ~9 H' C/ r6 `) H- h
{
+ u$ x. Q: S! b' R3 l alert("密码提示问题不能为空"); . y! z# i- k. S0 ?; T
document.sform1.checkask.focus(); ' K o& F, W2 N
return false; $ x/ H0 D" Y: l
}
1 T4 q( K& r1 Z$ _ if (document.sform1.checkans.value=="") 8 P, H. p, H+ e3 H( g, q) z
{
3 j. x; y$ W$ j5 z alert("您的密码提示问题答案不能为空"); ' a; B' S" z" Y
document.sform1.checkans.focus();
5 z U. J& f. `8 H+ |# M* {4 l return false;
5 \5 \6 P( g: N8 D }$ z6 A& y$ ~( a! s* Z- r
return true;
# l0 ^5 O, f$ t2 g2 j n6 q
- @9 H$ h% M% D Y5 I}
4 d& Z. H+ {9 ?( Y6 f' f</script> |
|