|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14341
- 金币
- 2456
- 威望
- 1647
- 贡献
- 1404
|
这个脚本对你可能有帮助:- ?, Y) Y- ~4 M" v4 q
<script language="javascript">
; n/ W' p) J o) jfunction IsDigit(cCheck) + F# L! v( T6 ]4 T5 t6 Y" L
{ 6 w; [- g. r! h9 ^ P
return (('0'<=cCheck) && (cCheck<='9'));
! m1 {1 W9 K* x! T9 G }
, V4 N# O* F, ]4 r/ K
/ C3 |8 W) [: H) Hfunction IsAlpha(cCheck)
1 `! V" f7 ]& R! z; R/ ] {
2 m$ m( e% R; w3 G" H2 D return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 b0 F9 U; j D1 j2 T# Q$ U' a
} 6 [/ `: l' @1 u( P
, H; g8 V3 n# u' t& Gfunction IsaNull(cCheck)
: R8 P0 B4 W0 x8 J( v { * ~& a5 z; I( n i' u
return(cCheck != " ")
3 V0 Q4 C" |7 b }
1 L: i% f" Z( V! t) ?0 J" n; ]
; P$ O. J# [8 \+ S% T8 j/ W* \function checkform() ! q- [% e3 M- L+ I
{ , x5 I; m) B5 f+ w' Q/ i: ^
id = document.sform1.id.value;
* a: ?7 O$ ]2 b, @ if (id == "")
0 d: k# D9 T7 W3 ~ { : t1 T& v- T0 E1 R: A
alert("请输入注册名");
3 q0 f, b9 J, C/ p7 b- d! w document.sform1.id.focus();
a* |1 p0 _% [" d, l0 y return false; 5 L% b: G! j0 E: r" \* E/ u
}
" L: P& J. A- e# W
- T6 Y+ O* d' F" H& s9 R for (nIndex=0; nIndex<id.length; nIndex++)
3 P7 O1 t5 O- T; z; \' q { + W: |0 Y, q( I" |
cCheck = id.charAt(nIndex);
% I' w# B' {8 w: C1 } if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) & M0 E! L8 e; b8 y$ g
{ 7 `+ z" O/ R) v* l
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' }; Y5 I4 d# H7 T1 j6 Q
document.sform1.id.focus(); " Z# l& d! i; R3 I4 D( f# O4 A
return false;
8 ^/ O6 b& g; P3 L7 c/ k }
/ a( I4 l" f4 h3 A) f* l& `$ e } W# Z; h) c& ?9 V* c* Z
chineseid = document.sform1.chineseid.value; # J( K* q9 R2 L6 W
if (chineseid == "")
* G! _7 J+ U$ X {
9 n+ Z" B/ Z# h, L alert("请输入中文昵称"); B& Q& n) S" L4 \' I! ^' a
document.sform1.chineseid.focus();
( _; ~; q1 r( o return false; , d( W& K) c# {
}
7 Y+ b. b+ i; z- p: P/ W password = document.sform1.password.value;
; b. H4 H; c: a if (password == "") / B4 u( P9 C$ i, D
{
" A6 [ @+ ~) q7 J" ^6 N alert("请输入登陆密码");
0 n! ?5 \" J! z% }+ O$ \; n document.sform1.password.focus();
2 W; G( ] j& [+ V return false; 5 u1 W! P" }5 I/ ^: H" m% i1 }
} 6 }5 o1 ~3 g! F$ j- T7 D
password1 = document.sform1.password1.value;
8 c6 \( f- D4 [- T if (password>password1)
4 L/ P( m" I' ]5 ~8 q6 N9 l8 f {
- [9 f4 [2 {; U7 Z9 E4 O alert("重复密码与登陆密码不相同"); , _. @( ?0 t" c% n$ C
document.sform1.password.focus(); ) Q+ [$ k5 g+ }! \, w! U% Z2 |. ~
document.sform1.password1.focus(); . C& m8 J5 d6 }3 |2 X
return false;* l- ~$ B1 I1 p1 S) P
} 7 t# A& Q* P0 Y4 }
if (password<password1)
( h+ S2 b$ m: ~ {
3 h$ P; D, }' }: _ alert("重复密码与登陆密码不相同"); 4 K V5 p5 d+ `6 c
document.sform1.password.focus(); . P( ~+ x% r( I5 K$ \- F4 e
document.sform1.password1.focus();
% ]$ F$ g- ]9 M! S& k! r+ u0 } return false;: N" t1 p. Q9 j" T0 r# s( a+ U
} 3 f1 K% N& V9 p! a6 L( }5 O6 j& m
if (document.sform1.email.value == "") 5 B8 ?+ n: q7 y; g. \( T
{
, W( F6 b, [+ c- N# ~+ N alert("请输入您的E-MAIL地址"); 6 Q, o( o1 L" e
document.sform1.email.focus();
' |. G" {5 u/ W; \* \& l5 P; X* Q return false;
: t- M( ?; Z, S: H0 [9 A3 ^$ q5 J }
5 O: M* o* `% v$ E/ v" c0 ` 5 @+ D8 T1 K& H
email=document.sform1.email.value; + v J T; o" }# L
emailerr=0 ( x1 _1 T# q* ~& l
for (i=0; i<email.length; i++) " w& c g/ \" d) m+ C9 @- F
{ 8 _1 Z7 O; |# B" x( N
if ((email.charAt(i) == "@") & (email.length > 5))
0 ~8 A3 v8 K- A1 O {
" d( m. h) b$ i B emailerr=emailerr+1 q8 l" V( E6 F
}
$ }. F3 _3 Y. T( @2 O8 {: F1 F }
! t. S3 J! ~0 [; M' ] if (emailerr != 1)
/ A, [+ w5 d8 U: Z% t( ` { ; c) ?# ~/ t3 G) K' Q' i, p
alert("请输入正确的E-MAIL地址"); * v, s# _7 w" }- c
document.sform1.email.focus();
; O; M) z4 N4 F; M! H return false; 8 l3 H. S% N) y" v
} + g8 m f! ~; v- f6 g8 H! Z
" L, ?" ~) P) |7 _* [& k& F+ `
if (document.sform1.checkask.value=="")
6 r! B( M5 g% l4 n3 Z { + T6 b S1 F ~! K. J& A3 _8 J
alert("密码提示问题不能为空"); : s. R9 G9 x1 x$ k0 g! o+ F# H* G
document.sform1.checkask.focus();
5 A* i9 d8 y" n. B6 g return false;
' L7 l6 T* W5 ~! b } $ Y- p+ C t) I3 E% @6 H3 l
if (document.sform1.checkans.value=="")
) z2 t3 F$ X$ p6 O; [, G' G6 ^ {
. W5 u2 d2 H6 W: T/ m+ N1 |: J9 s alert("您的密码提示问题答案不能为空");
: W: ?6 E$ T% h0 }3 n/ f document.sform1.checkans.focus();
+ A' B/ E2 c: ` return false; # t& q3 Q; J {$ R) A
}
1 @+ A. r+ Z) {; H return true;
9 h7 }/ ?' F6 H# I( Q' \6 G 7 c+ i" U/ K( B' _! C+ c: _( q# O
} . l7 n$ J$ @3 W% K$ l+ U
</script> |
|