|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
这个脚本对你可能有帮助:
* r8 w' d9 b% y7 `- t8 x% @' I# Q<script language="javascript">
/ T4 G. y+ A1 o6 Ofunction IsDigit(cCheck) % S9 r5 U; J9 D2 E" s0 D) U$ [
{ : e. w) ^& K" Q! C; I* r' }) v
return (('0'<=cCheck) && (cCheck<='9'));
# J. t. {; b) l R } . {/ f% v0 m- B- J' p- ^
+ g9 H. E/ b M( t- T- a1 Y cfunction IsAlpha(cCheck)
; |, k1 x0 y/ l% @( g1 T W$ r: L { : T7 E3 ^( f ~2 J8 T, p7 ?
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
5 V" S7 y' D$ K } ( k" ^* c6 W, h' J; y, v8 [$ U
8 p+ b# [0 ]; E7 L/ U1 Yfunction IsaNull(cCheck)
+ i% v. a/ X- k h) g4 \' r {
1 N4 ~4 z0 C7 C/ a return(cCheck != " ")
: f; k& A4 a: ^; O% @5 M7 P) ] }
X9 n9 D/ N W 5 f* B8 c& j4 k$ Y# F7 H5 u
function checkform()
0 S, K+ v: p' F8 A{ + \. g* R0 s3 b$ \: y8 Y. K
id = document.sform1.id.value; : f) `) q7 G6 P0 f5 P- P
if (id == "") 0 u! H& O- |6 L% U9 K
{
- u& S2 }: C- k$ A# w [: H4 d alert("请输入注册名"); 7 U, `+ |" a0 N
document.sform1.id.focus();
' g' _0 q/ j) \% ]6 C) w; [ return false; . I; p: {+ X1 e
}
, N" K) g7 \6 ]8 G! y/ R- F9 b " h) h1 s6 H: o. N* C" |; s
for (nIndex=0; nIndex<id.length; nIndex++)
4 ^! h% J, n; A/ r {
; U, X1 V% N; w cCheck = id.charAt(nIndex); ; g0 a7 g% Q1 X, b) p7 z
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ' Y v' n: O0 M. H% M3 z
{
6 g5 h# a G* B3 G alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
+ I, t7 F' l: j" d" A document.sform1.id.focus();
8 ^; b7 V. z* G3 ]) n3 M return false;
4 R" g+ X4 c0 u( }- A0 j# `: z } $ {' M& G! l2 f! L: i
} " V! h9 u+ E7 ]. N Y' Z- l6 j
chineseid = document.sform1.chineseid.value; 9 E6 o0 N( j3 x
if (chineseid == "")
6 W7 ]- |; N; I3 I* R! @ { , ^4 W" L% @4 G# P
alert("请输入中文昵称");
2 |3 p6 n& A( ]3 A t( C* {) Q; c% N document.sform1.chineseid.focus();
* A9 w4 T4 g/ [! ~6 y, }* ] return false; , n! Y5 H- l2 t
}
1 a7 |2 Y+ y+ L4 V password = document.sform1.password.value; ( u+ u: l; M5 u+ o+ B9 n& n- ^
if (password == "") # _) l. V3 E; s% f# ?
{
/ E4 L. u; J: e8 w$ @4 D alert("请输入登陆密码");
1 ]$ d# z' D* _9 g( F! X) F/ J2 ? document.sform1.password.focus();
+ P( a) z4 `& D( m" w return false; ! m" T# ^/ i2 J& n6 e0 w% V3 n' W- i
}
* ?6 F3 w& ]$ H7 _" N b; ]) n password1 = document.sform1.password1.value;
4 U+ N3 {9 h5 b1 p$ C( J5 R; g if (password>password1) ! y/ e9 l/ ^1 Y3 N6 F' Q, G
{
5 G+ d5 ^7 O/ ?: }$ S- @- X% C alert("重复密码与登陆密码不相同"); + s# G) }. N y6 Z
document.sform1.password.focus();
% p# U- J. T% Z* e( O. V document.sform1.password1.focus();
5 v( e' q. V5 h# k return false;
% t. L8 {, D6 Q+ a! g& m/ G3 j' _ } : i( }0 N( D! _" l0 j$ o
if (password<password1)
0 Q9 z) |% v+ ]% N7 |& [4 k {; I# A( w: h5 j
alert("重复密码与登陆密码不相同"); . T0 K! |2 K F$ y( V, P$ l
document.sform1.password.focus(); ( W: r& I- y& `
document.sform1.password1.focus();
, S/ G6 ?, [ w" E" \/ _ H1 H return false;& P# ?* X; _; J6 V
} $ z9 W. T; K* r Z0 ~
if (document.sform1.email.value == "") & S; l2 ^/ `/ i9 k
{
3 \2 H9 b) {( a alert("请输入您的E-MAIL地址");
1 j$ K: K# q) h( F; r8 u7 V+ A document.sform1.email.focus();
0 _* V3 h0 R% H: A# C l return false;
: j6 L t3 y2 ]! p( E1 K5 ?( P+ g }
% f0 t/ i" X& r! I _2 \; E 9 C% E8 s# M0 F, F+ F
email=document.sform1.email.value; 7 F6 E# ~5 E; b6 l8 [0 F: @ {
emailerr=0 ; D" t$ R2 |/ ]: ?/ S$ d3 [
for (i=0; i<email.length; i++) % c. v0 W; f5 V0 ]
{
: e4 s& [ Z, S( F if ((email.charAt(i) == "@") & (email.length > 5)) 8 g6 V M' R8 h4 u6 w! b
{
7 u) [. h5 m4 p4 j# v* X8 \ emailerr=emailerr+1 8 h: Z9 @/ A( `9 `3 R; @
} $ Y/ j! C3 L0 G3 s& z- k, W
}
5 N4 Q* n) U3 @' Q* a# ]5 e. B if (emailerr != 1)
+ X! z: X% \9 ~1 F) \$ F {
( V' p& O, Q U% ` s- Z# {# |" y alert("请输入正确的E-MAIL地址");
, }- {* M- o( s; R# g/ j0 ] O" @ document.sform1.email.focus(); : }6 O& H4 A9 }% k5 t) X4 }
return false; . X+ ?3 h: K) `' e: l
} # _* }# E. u+ _0 ], o9 z) f& K
% l& A) X; y+ [
if (document.sform1.checkask.value=="")
[6 h, Y) e& q5 P9 b {
6 Z" s$ i, B# N% n! ?7 }+ V2 N0 f8 g alert("密码提示问题不能为空"); 2 @+ O9 h' g8 z! y; p
document.sform1.checkask.focus(); ) r. `9 q# r6 d0 b( M
return false; 2 x- o; N1 q; ]4 I ^4 Y/ ~
}
0 J9 E& i- Y; J7 b: W5 d- D if (document.sform1.checkans.value=="") - ?3 v$ E. p' I6 I
{
+ b: l& k$ Q2 G* m2 | alert("您的密码提示问题答案不能为空"); 5 X$ |, |; E( [7 Q4 z. j) G
document.sform1.checkans.focus();
& V# n3 n' v3 ?1 z- O- S- b [* i2 C return false;
7 u8 S! q) B: z& ` }
7 P5 q" M2 n7 |6 M( X9 F# F4 G return true; * t; f" Y. H. J7 v8 `
0 k% }" g: o, V: T6 I3 l# F}
, W3 G \, j/ O& m9 ]* ?</script> |
|