  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
这个脚本对你可能有帮助:, I2 f& t) k9 R
<script language="javascript">
7 N: g0 z8 c! r) |function IsDigit(cCheck)
) ?% o# o/ G! U {
1 l# o/ M" ^& H2 B return (('0'<=cCheck) && (cCheck<='9'));
1 {: L t7 U- o7 A7 d3 h* j, o } % H+ N" k9 u/ x, K1 Q b- }
8 {5 H+ _& P" S' `; u9 A3 E2 r i
function IsAlpha(cCheck) ; k" a; \2 m+ V4 c" B N
{
2 z; h9 B1 n! S/ Q% n/ M& a return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
* S) ^7 V" ], A3 \. F0 a: S7 o } 9 x. A( X5 Q0 ^3 {
8 Y7 N, Z' Z4 c
function IsaNull(cCheck)
H) e8 q9 B' f3 K4 J { $ U! b% H/ j$ |/ _) I5 {
return(cCheck != " ")
5 L5 I! P( a e7 z1 Q5 N } / z7 l) ]" f, X- V
- l q7 k8 f! G
function checkform()
s+ t5 ^ W Z4 u( u! Y0 x{ % h& z$ O% g- T+ R7 I* C
id = document.sform1.id.value;
h* H- g' J: K* `0 Y- v( t if (id == "")
; _1 h0 n2 x, N% G$ ] { " Z' Z, x: Q- o0 j: b# a E+ l
alert("请输入注册名"); ! h# R+ v) A8 C ?: C
document.sform1.id.focus();
- e' ^4 N8 r/ L! o return false;
: w( q. K T( \ } 4 P0 r& H9 Y) p u0 w7 e2 P
6 V i) d. Q n- }7 ` n5 |
for (nIndex=0; nIndex<id.length; nIndex++)
; I$ @5 n. e: A- b { m+ M$ d6 a& P+ l
cCheck = id.charAt(nIndex); % K+ w# w& Y% G
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 q) g- s# r6 R& G) A { ) @! E! H1 E' }2 Z4 Y8 n
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : }( b9 a% v2 H, l; j3 ]( g; ~! v
document.sform1.id.focus(); . ]' q% g- e9 g6 S) c6 K" {5 K
return false; ) D' _+ w9 C. m4 y v8 ~, ?- X
}
1 _; e; d% K; j5 x( H: g+ d9 [9 { }
6 a" {8 e* m% W$ S1 O2 f chineseid = document.sform1.chineseid.value;
$ D! B& M, ~/ e! W: ^5 C if (chineseid == "") 5 D: j' X) H6 _2 p( K! G2 V
{ - i; J1 Q# i" N k. B5 s7 Y
alert("请输入中文昵称");
5 R- ?0 T( C. u2 n1 k6 K( w document.sform1.chineseid.focus();
/ d6 u" \. ~5 ]3 }) H return false;
" }+ S( W' E+ G+ x }
1 r% [; |1 u8 [# x: B f* D password = document.sform1.password.value;
/ R; d/ s) D5 b1 k if (password == "")
. h/ o6 t# e! [( a { . {0 J0 F m# }# L0 [/ _. M% o
alert("请输入登陆密码");
* Q9 x9 O8 J- N8 J5 o document.sform1.password.focus(); + o8 _& \ `% N* J8 }
return false;
" R! p$ `5 G4 F* z5 k }
( l4 P# F7 ]! v, b password1 = document.sform1.password1.value; ! H3 H" J5 g2 c+ F
if (password>password1) 9 C( V7 r! @9 j2 K5 A3 f+ {$ n
{
' z( \$ l, [! S( _! u alert("重复密码与登陆密码不相同");
+ u- I; u: z% M- G; Q. T" x& L document.sform1.password.focus();
! s& A% ]; H* x+ R document.sform1.password1.focus();
) A" X* J9 I: D return false;7 t1 e' b4 j7 l, h& O% u) A( s
}
' f) Y2 H/ h; M2 E0 yif (password<password1)
( i- K3 c6 \. O1 z$ a( C) L {. j9 r5 y6 c6 _' @ x+ b. I. ^
alert("重复密码与登陆密码不相同");
8 Q0 r5 [9 _# b+ B document.sform1.password.focus(); 6 @0 U/ R6 [# `. o+ m& ~1 k
document.sform1.password1.focus();
1 \- f+ L2 }( `- q3 } return false;
/ A8 ]( F7 g0 K7 F+ R }
- x4 C" P9 w* y! s! S# X+ S if (document.sform1.email.value == "") . `4 T1 n0 I; H, }4 a
{
4 g+ _$ i/ |+ j z alert("请输入您的E-MAIL地址"); ! R! V6 g1 P9 @0 J2 f9 R! l
document.sform1.email.focus(); $ z' }. L3 f$ p$ {
return false; ( K4 h- d3 a3 s
} $ }7 L5 j0 q4 R* a5 X; o. C7 y
2 B, M' U# [6 t email=document.sform1.email.value; 8 d- N$ l }5 U- q
emailerr=0 7 R9 H2 S0 l% i+ P1 p* E$ |: U
for (i=0; i<email.length; i++)
! I' ~/ R( W9 ?( j {
# r$ I3 N/ D$ B$ |. y7 R, U. ] if ((email.charAt(i) == "@") & (email.length > 5))
; F' B. X+ O4 J0 b9 g { ' w! @$ X! n, X; t& o- m( S
emailerr=emailerr+1 $ d0 _$ x: e6 E
} % d6 m7 z, J& z G" S& C% w
}
" g, b& t- T: b. W if (emailerr != 1) 7 e" h* \: O: k- l6 d' e8 h
{ , O; |( u% \6 y5 n9 g& E7 e
alert("请输入正确的E-MAIL地址"); / z* G8 n9 e9 n/ @: T3 \+ s9 z
document.sform1.email.focus(); . m- L7 _9 e, x8 }' Y1 [* s6 u
return false; & C; @$ ^; {/ k0 H3 t
} , f0 @5 U& n J0 s2 U, D& R
6 p8 H+ k5 m8 I6 K
if (document.sform1.checkask.value=="")
: ]( q. X& g! { { 7 f, D8 e9 P( e" h$ U
alert("密码提示问题不能为空"); ; Y7 G3 X4 _, F
document.sform1.checkask.focus();
5 n% C7 g2 ]) Y9 p* ?( k) C! r0 E- S return false; . M! Z9 m' z1 H
} 0 U$ M2 U! @; e, {0 S% E
if (document.sform1.checkans.value=="")
t, g$ M. w8 g: M3 S* p { " E* W1 ]- V, n7 p6 M/ e
alert("您的密码提示问题答案不能为空");
7 w7 N- L( J( r9 F1 e document.sform1.checkans.focus();
$ }- s0 j. E% F. ], ]6 h5 c3 C q) J return false; * x: p5 \* H; I
}
8 y$ c, [( ]' t z, E& A. F0 p( Z return true; 7 t/ y& b/ {1 [* b2 O
Q' c2 n# o, V! u9 q/ t; F; n0 w. b
} 5 P7 F4 W6 J! z
</script> |
|