|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助:
* n( V1 N4 k9 `' ?9 T<script language="javascript"> 2 v& t P1 s! b) Y! m! e+ Q i
function IsDigit(cCheck)
- c* W; @& G& g- u) p; P5 { {
) K$ x0 ^# m: S return (('0'<=cCheck) && (cCheck<='9')); ! I4 G! T) ~; ^( z9 A& N' V" f: z
} # A3 s7 A" r1 `
: J8 [7 V& ]5 {& ?3 n' v9 R
function IsAlpha(cCheck) ! g& Y2 Y& Q8 _( R" r
{
& K$ R! o6 b7 w" Q return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 E% ~5 m9 Z* z6 } } 6 |$ _3 O+ l- U5 Z" O
$ W. G' L4 W; I9 R# I( a6 M
function IsaNull(cCheck) 0 P8 g3 J8 d+ j' W
{
; r* s6 o% ^2 t0 b9 ^ return(cCheck != " ")
( ~( w8 U L4 ^8 R. s } 4 D) r" b6 G7 c- j0 i* @
# c: S. x( c. M3 N
function checkform() , c8 U4 [! U( e9 h
{ ) r& W' ?4 H% u, Y9 X! X* E* l
id = document.sform1.id.value; & G6 l# ]4 l5 W, c) l* [
if (id == "") 5 U- e" C5 ?3 b; z, e
{ & L3 z* x1 r2 F4 V* o
alert("请输入注册名");
9 a) a% Y, J1 T+ P document.sform1.id.focus();
" {) u1 ?' ?( ?/ C3 r0 F return false; ( u. I; Y4 V1 c' M
}
' t# Z2 C$ M6 s$ d* W . r$ n6 b( ?2 Q. [' f* V
for (nIndex=0; nIndex<id.length; nIndex++) & v$ ?. q+ z% _
{
: e6 A6 O, d; @# H% M6 ]2 _9 r cCheck = id.charAt(nIndex);
0 [/ n/ {1 n$ j" x- Z I if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% u1 \" r9 @! g# | Y" U { 5 B- G4 M: [ X; Z' e& [# s
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' N3 ~# r0 `6 Z$ f document.sform1.id.focus(); 0 Y0 ~, o w! ?
return false;
: U; i* a4 s: t! n/ s/ \& A }
5 V( F7 K6 p) x+ K( J$ V }
1 O8 J- E7 E9 K3 j; g3 A, R5 }# B chineseid = document.sform1.chineseid.value; ; q' J/ @( W! c% U
if (chineseid == "") $ ^3 V; b( r" t G, P; M m$ @
{ 1 u5 L( U5 q7 n8 w& i
alert("请输入中文昵称");
) p$ X c7 w9 l- O! R document.sform1.chineseid.focus();
; m' m8 C" e7 L! t return false;
: s0 ?5 L& F2 u G$ N7 ^ }
0 O8 g/ @, O9 |3 _! R password = document.sform1.password.value;
+ K! B! }- k8 ?- Q if (password == "")
) p! G0 B" h2 E& f; w6 g& D! y" _ { t! p0 K+ ~+ n8 H" d) ]
alert("请输入登陆密码");
7 y9 T0 Z# ? x. N3 l6 h document.sform1.password.focus();
. F1 V: l) s2 F/ g' [: t return false;
6 t* M X5 S2 ] }
0 E i6 U5 K' z9 @& Y5 B password1 = document.sform1.password1.value; \/ E3 m- w [- R( f+ O, P
if (password>password1)
2 W0 Y- M+ r4 Q8 ~ {
/ B" R! {/ M- l- J2 _ alert("重复密码与登陆密码不相同");
% p2 s$ V# f. N# ]6 z8 y ^ document.sform1.password.focus(); + N! T1 l/ j, y. E
document.sform1.password1.focus();
6 e- q" G- U; c9 K return false;
2 S X7 k2 K- B9 Z6 Y }
1 r) s0 K5 {+ `* _, kif (password<password1) ( J/ ?- C2 J1 k6 U) r6 G& p8 |" g
{
7 R3 C ^% B7 Y( M, w6 v% Y alert("重复密码与登陆密码不相同"); : f, Q$ M, t$ K& p; L
document.sform1.password.focus(); 2 Z. L* {& T; }) m% W7 }/ |7 {
document.sform1.password1.focus(); . H6 b2 @; V. m1 F/ o5 `
return false;
3 }) s+ q$ N: b( h$ r }
( z# A8 K/ s- c! W v; G, j: S4 ` if (document.sform1.email.value == "")
8 z" n4 ~5 b5 ]' S( A, l {
, e4 y7 o( W/ q alert("请输入您的E-MAIL地址");
0 q1 I: e4 o4 o( f6 n document.sform1.email.focus(); 1 z& p; S* K8 i! O
return false; : o# \- j4 Y/ A/ v6 i: ~5 P/ b
} 3 A( b: U H# F( ]
$ K# _$ L& \2 D2 `* \
email=document.sform1.email.value; ' E2 f; x$ B: ], F4 G2 @/ u* s0 I2 c
emailerr=0
) |3 M+ r a1 Q* T8 i& ~2 I, m for (i=0; i<email.length; i++) $ }% s7 w D$ i0 A' Z. e
{ ; h7 h9 B/ o4 j0 F! d; U
if ((email.charAt(i) == "@") & (email.length > 5)) 1 e( N! W% F& U8 t7 p7 `" G8 [. B
{ $ A* ^6 C9 i" a' q% L& z
emailerr=emailerr+1 ) [, a8 v: H' d) [% e6 G
} - r6 a; `' {" F
} * a/ g& H1 ~: C, @0 A, ]6 k
if (emailerr != 1) 7 M, K: \" D) a" F9 g
{
8 i. q _/ {$ j5 s4 n alert("请输入正确的E-MAIL地址"); 8 w" B) R8 z% R! I4 q9 p
document.sform1.email.focus();
% @, c6 G2 j) D# D, W& ^ return false;
* |1 i) d: |( g% g% V }
+ ]! m' _: E4 ^2 ~7 { L. F2 P4 E
3 @3 @3 e+ W' ] if (document.sform1.checkask.value=="") 6 W% }+ j# g+ h1 h& T- n3 ^! u/ f
{ 8 M( f, U+ g5 B8 U
alert("密码提示问题不能为空"); 6 C4 Y% a* P' L. K: p9 `7 S4 i
document.sform1.checkask.focus(); 9 _" o, @( J0 J2 e5 F) h
return false;
2 H* @9 U- P- Y+ F4 g } 2 w- O$ w9 [0 J3 `- [ t+ @/ z
if (document.sform1.checkans.value=="")
' r6 _! Z, x: a {
* E3 `% W- I0 b% u; I" l- |5 A alert("您的密码提示问题答案不能为空"); 5 j. |4 N4 g A' I. E7 q6 Y
document.sform1.checkans.focus(); # Q r2 f6 c8 H2 F1 Y7 M4 x" K
return false;
\- {0 o. X# R/ J }; c7 T: w9 Z+ l; ^: z9 L
return true; 4 Z. W i, p" g9 \0 |
0 e* Y) l$ r& q} / C& i/ }: }( t( ]
</script> |
|