|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14357
- 金币
- 2464
- 威望
- 1647
- 贡献
- 1412
|
这个脚本对你可能有帮助:
5 q% [4 m$ ^1 m<script language="javascript"> V% c/ X) T% ~) {) e* ~6 c" X! X
function IsDigit(cCheck)
! _/ ]# _4 q% H9 W4 M; L7 Y {
% f$ c: c/ u3 ^0 m7 S return (('0'<=cCheck) && (cCheck<='9'));
3 S* l# P: b8 n$ R( l# w& c }
$ k6 K! S+ o. _2 ^5 X
+ P. R: g# G% W. L/ h9 d6 Ofunction IsAlpha(cCheck) / w7 r1 s, \9 d3 s! `# w( E
{ 1 ~0 c- p( F" h3 j Y) ]' J! P4 i6 r* m
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
1 E: {% j4 k9 S _" C0 }( _' d7 g }
, K1 q8 `' F! }6 n O 5 `7 V& S- `% \- q% t# @
function IsaNull(cCheck) " _8 e b) W! b0 d6 M
{ + q% a7 e- W. W
return(cCheck != " ")
+ ^' g* [) b) J4 S } - H: k5 ? `+ J2 \: t4 ~- [/ Z
/ [% n4 K7 ^0 r5 {* Z) P
function checkform() , F( L0 `/ {, H/ V
{ 8 `9 G! M2 ? W2 `
id = document.sform1.id.value; , M2 G ?# H3 _8 [4 U' v8 k
if (id == "") 6 I4 v% R( K# Y% F- z- Q! E
{ ( g8 |& m, D7 y- F
alert("请输入注册名");
- N% j$ T, o, P+ u$ ` document.sform1.id.focus();
9 Y! U" Q8 O* A& k3 b& e return false; $ r/ w: ?" V5 g$ K: G; f
}
5 V, ?0 \) r, ~4 m: {. Z. f$ R4 H , U- _% O) p F2 k* ?# H! @6 z0 M. q
for (nIndex=0; nIndex<id.length; nIndex++)
$ {6 I& r; c8 N) I5 c+ l {
1 F4 s& G o2 N9 v# N8 ?; { cCheck = id.charAt(nIndex);
% {- g$ \9 e1 U3 W0 Y! z4 i if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 ]+ p/ y/ K* ?2 _5 T5 [* l( a {
4 ?! M2 t3 R8 u! k0 I F alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) D# \. b/ k/ r; v5 C, P; B document.sform1.id.focus(); # |# x O8 B4 Z% k' i( T6 z3 g
return false;
; z7 \2 }) b* A1 _) s } : b5 w3 d: F+ W' y+ `* p
}
3 I$ V6 u$ R% s' ~ chineseid = document.sform1.chineseid.value; $ P8 d# x/ S; g
if (chineseid == "") % D* c, h7 E: G/ T
{
9 I2 Z4 ?6 [1 I3 C# _2 {& `6 O alert("请输入中文昵称");
! H1 V- n4 W, P4 K3 z( n2 K document.sform1.chineseid.focus();
% W, n8 w1 w/ b return false; : Q$ j% O# z( y3 v' L! w1 O
} 3 j" m1 p. q( o4 U7 U1 O
password = document.sform1.password.value;
* K( K/ V* N# ?6 r0 |1 F: ? if (password == "")
2 z/ O" c0 V2 m9 b9 x8 E { 0 t$ T) o+ ?- c
alert("请输入登陆密码"); + p7 O$ ^1 c1 B, g& ^$ ]
document.sform1.password.focus();
) M; Z3 C5 e9 { return false;
* A5 O# t! e2 k, j2 G4 B }
9 x/ t0 t) n% [; Q password1 = document.sform1.password1.value;
( ~* }; ~! s9 | if (password>password1) ; b& F: ~. k: D" G& P
{$ z1 q" s. h: t/ x+ `! c
alert("重复密码与登陆密码不相同");
* x0 A2 E6 z. R; ~9 m document.sform1.password.focus(); , m' X+ u/ g B9 B3 E7 G/ f9 ?4 K$ H
document.sform1.password1.focus(); ! P* j% v& _. J1 ]
return false;. v6 y/ }/ c m4 x0 u1 l# Y8 M
}
4 a! j6 `: \: v% s) N1 _4 X2 kif (password<password1) ( N. Y9 g, W7 D9 P+ @
{ p. X( W5 V8 w" Y
alert("重复密码与登陆密码不相同"); 9 ?! C+ _' O4 a1 i! h# P. A1 w
document.sform1.password.focus();
a( h4 K+ i5 j8 @" B; k document.sform1.password1.focus(); / _5 c1 W3 F" {
return false;5 b; J% l' x1 _
} / D2 x1 u' j$ p/ D
if (document.sform1.email.value == "")
1 l* ]1 [$ [- A( w. o& F { ; D2 L& w- S* b' T
alert("请输入您的E-MAIL地址"); # @& }9 n% O. |3 b( m, S& F
document.sform1.email.focus(); 4 C5 {8 F4 \: ?6 }7 P
return false;
; j K* J& I' h. X7 h4 u5 t }
9 r6 a. I0 [0 ~" e% S$ S
: T# p, V s7 m d; c o email=document.sform1.email.value; % Z! T5 Q$ y4 y8 S( J& a2 x
emailerr=0 3 W( n9 k* K4 L% j
for (i=0; i<email.length; i++)
5 a3 A' d( x) b N5 ~' o% v5 { { - m2 W3 c2 a) o3 r; {
if ((email.charAt(i) == "@") & (email.length > 5)) * @* V4 ?/ U3 G' W" W9 Q
{
. i+ H- a+ n( Y( S* f/ @ emailerr=emailerr+1 + E1 e: F2 V5 R6 o3 p- a
}
, _, ]$ c+ z& X4 K }
$ E5 I# H* z- s0 p if (emailerr != 1)
Y( N. c' {6 m { ) c/ h1 @/ M' @
alert("请输入正确的E-MAIL地址");
! R6 T2 @: L( F( E document.sform1.email.focus();
+ @/ z# Y. n! A% u return false;
8 M) i: X' Q `, ^. c; M3 ] }
! q; r1 c, g( Z. ~! t- j / H% K/ S- I4 I$ S
if (document.sform1.checkask.value=="") " }" Y R# }! i8 t/ ]
{ * y8 Y" l& v1 {7 Y$ S8 l7 X9 e2 M
alert("密码提示问题不能为空");
6 v5 c" F J: h! `+ M/ M document.sform1.checkask.focus(); " I; K7 q9 z% A# P9 Z8 ]$ `
return false;
6 s' _. {! L( j3 ]! L7 u- T" u } & b2 o1 ]; q! L( i. m: Q7 i
if (document.sform1.checkans.value=="")
& _# D+ l L* j { ; S7 T) B+ F) [' k
alert("您的密码提示问题答案不能为空"); 2 u& Q$ f- I0 s( J
document.sform1.checkans.focus(); 2 z, L# ?; G; v5 W
return false; + v8 Z2 [8 }5 }
}& ?9 H' A% |8 C7 y7 T9 V. |
return true;
3 `8 L( g* |* b! x3 | : y# ~* F8 P' l' @- V
}
/ l+ |( X9 e+ q/ H9 n</script> |
|