|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14373
- 金币
- 2472
- 威望
- 1647
- 贡献
- 1420
|
这个脚本对你可能有帮助:( k! \# N1 m6 W% _- R: v
<script language="javascript">
! w9 g9 e# T: h0 N3 Yfunction IsDigit(cCheck) 2 {( O% [) y$ C! T8 R
{
& ]7 c4 r6 ^; j6 o. ?7 Q+ b, x return (('0'<=cCheck) && (cCheck<='9'));
1 l u9 l* i Q3 t3 Q! x }
; T% f8 {- Q% x+ p
9 T& @* f& a6 Nfunction IsAlpha(cCheck) % r$ y; O: `- G. Z
{ & S* H' R9 u9 z/ Z7 u
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) % l# S: }6 b+ ]0 d S u: L
} 7 n/ w$ P7 L: a* ~0 J1 E: l: H
" p# d& i5 @; }. w1 k, {! ]* I
function IsaNull(cCheck) # V7 e3 Z' f' z) c6 L
{
s; \! q* S1 b; g) y) g return(cCheck != " ") ; I" z8 M7 I+ w8 T
} 3 T8 {: `/ d' p! B, W
/ ?+ y* X+ |! _; Ofunction checkform()
; M8 b5 [9 d9 G8 j2 ]{
2 F! ~0 c/ @* { id = document.sform1.id.value;
4 a$ G7 w8 E7 D2 V: m( H+ E; { if (id == "") $ T8 X! @+ t) C
{
9 K8 \* f5 F0 z, |0 Z- Y7 E9 [( m' ] alert("请输入注册名"); 9 g, ~2 [2 |# ~9 s. `. m$ R
document.sform1.id.focus();
* U' {# f8 b9 ]- h4 D return false;
/ L9 m( M" _, ~' K( U+ [8 k( p, n }
3 E6 ~, s& N: K+ T# M: e- T$ c4 ` $ E Z) {5 w3 r$ i2 B1 _8 z7 n
for (nIndex=0; nIndex<id.length; nIndex++)
& u' q5 z( r6 {( z- y { & R2 n. t: g% o0 m* x3 S/ n" z! j
cCheck = id.charAt(nIndex); , Z7 m- H7 P- V: U0 c, J
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
3 Y/ c" J8 p5 Q% z" l {
! `* G3 s# V* K: r7 }8 r alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 0 f; Y$ Y# m) U0 d) T
document.sform1.id.focus(); 6 w( v ~- Q* I/ F% D: C( c# h2 u
return false;
* J ~: {9 \# N7 B% O } 6 p, @ o( x8 M) B6 t, q7 X( E
}
1 }5 G3 y) J% G/ |1 d/ {! n6 Q chineseid = document.sform1.chineseid.value; 7 g) ~' K/ j& o
if (chineseid == "")
* A! b7 y& v9 X8 @6 v9 V; c { . y- g; p% I b1 R: n
alert("请输入中文昵称");
. C0 f: o" f, b; o; y' A; z document.sform1.chineseid.focus();
6 S( I! {: l- D& ?4 r7 z return false;
+ M8 o* y! m) M } , S' o) @) c! T
password = document.sform1.password.value; ) a6 p8 Y. ?- ^8 u
if (password == "")
* P! K' k- Q$ d. o; h { 8 c, p/ |8 q- S; s5 s% X6 y# b1 i& e
alert("请输入登陆密码");
$ M% a9 g! w* P4 x document.sform1.password.focus();
. }. E* D0 H, O+ \" E2 x( ` return false;
) h$ R0 J3 r" u Q } 4 s! ]4 ~8 g1 C* |) |2 A; b
password1 = document.sform1.password1.value;
! s3 A8 k1 {$ V, n4 L if (password>password1)
' @( I, i( p; U2 s' Z {, @& D: a3 x% i d' {5 F
alert("重复密码与登陆密码不相同");
( `0 ], E& @8 D) c0 V3 x document.sform1.password.focus();
4 \ r3 S- j& E" H; k- S document.sform1.password1.focus(); ( s- Q( W! }7 u) w9 j) E1 o& V
return false;
: L% T5 i" T1 a# ]+ |" ?+ R. E } ! L+ v9 @( M' r+ _: y4 L; U( q
if (password<password1)
3 _- g7 J3 O7 C7 a+ {2 Y, S+ D {
4 @) e: I3 U2 x, c; t" T; x alert("重复密码与登陆密码不相同"); " e( n( u" B6 e9 O8 n
document.sform1.password.focus(); 4 _! |8 d9 [% A6 L& Q7 o# W
document.sform1.password1.focus(); % u5 d: W) a. Y
return false;! E3 C" O$ q9 ?
}
1 K9 X# {0 k2 d- o2 M. b$ o/ a if (document.sform1.email.value == "") 3 I: \4 V. E( d7 Z3 T0 t& c
{ : w1 @1 e$ c \2 w+ t
alert("请输入您的E-MAIL地址");
, b) Q% M( i$ m" [; E document.sform1.email.focus(); . w: ]) k4 m1 }' V
return false;
% j' ?( }/ ?8 n r, Q' c: z }
i* `- m; O8 L, H! `7 @7 D' ~/ H
9 ~- B' Q; w4 K8 \) W: s email=document.sform1.email.value;
5 L e! F8 T9 Q( H: {, R emailerr=0
7 h n( r% ?; e8 D: T. w0 I3 k for (i=0; i<email.length; i++)
. J$ b. z9 ]! g" u) ^. q: z {
2 w. ?# |8 @) F2 ~' W% c7 h# x if ((email.charAt(i) == "@") & (email.length > 5))
# A4 u& |2 I6 A5 m$ Z$ ?0 ]$ J: ] {
]( _0 l4 v9 N emailerr=emailerr+1 ! T- |$ u r3 @5 I/ D5 C( ]
} 7 @! J5 t0 Z+ g9 V! \+ Y
} : T* W! s5 W! L `9 }1 s4 N$ D+ ^, Y
if (emailerr != 1) + u) d! e& P* p/ e$ }! I
{ ) G6 P) T5 X& U- H! L/ E6 r+ N# A/ I
alert("请输入正确的E-MAIL地址"); 3 D! D# O7 O7 x- @) a+ s/ a( s
document.sform1.email.focus();
6 g7 n) o. P y! B* x return false; % Y- L- b, P1 d4 U" \+ O
}
/ m; v4 A7 i' e 9 \$ |/ U# L$ r& S1 R
if (document.sform1.checkask.value=="") " r5 W, h5 d& ]+ f7 ~" Q
{ 8 a. [2 |; h" ^' f% c) }
alert("密码提示问题不能为空"); 0 s, F: N4 B7 P* k5 Y& h0 D
document.sform1.checkask.focus();
1 ?# h) G5 b/ u* M/ x" D return false;
" k0 }" D/ H2 K8 N' ~- U) ] }
p! F7 f% I' ` if (document.sform1.checkans.value=="")
. ^$ q( v% L$ A! l2 e {
% o! H0 b, ?% m7 | alert("您的密码提示问题答案不能为空"); ! H) `, `! t- ^7 L E3 J6 ~3 x
document.sform1.checkans.focus();
5 N0 m, Y! _5 h& j0 o7 t, F, a return false; / s6 ]9 p& }- w U
}
! I( O7 ~* Z. Q. U return true;
. W! `9 \1 k4 o1 z. a8 k
W2 c- [; j! u5 d; m; v. Z3 H}
4 t" X* Q. D( w8 |6 _9 C# `- H8 l</script> |
|