|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:+ j8 y& ?+ Q$ {3 u5 M& y0 O" k
<script language="javascript"> 1 W' k+ L5 I8 \- X$ X
function IsDigit(cCheck)
3 |1 @3 `0 T& i" S { $ w9 b" V4 P' i2 B% w+ `0 v
return (('0'<=cCheck) && (cCheck<='9')); : g9 N" \: h" r5 S' v. c7 ~( _6 j
}
+ Q- O R9 k" ?$ E n$ r/ {; Z1 P
) L2 D7 r+ w8 {9 H zfunction IsAlpha(cCheck)
: `, t* }% P, d9 p8 T K { 0 b O) ~% I% y- l
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) + ]6 B3 b$ i( F- [# z5 |
} ) D$ l* V2 e1 k. b
3 w: e1 `, H) X) }$ E! f9 nfunction IsaNull(cCheck)
* P0 A9 c; H% s! K$ }" R. H. |0 ^: l {
. m# `$ W1 [; j# N- \$ ^ return(cCheck != " ") ; I3 _& E2 Y, d% d4 L
}
& S! t; c6 S" ^ f ' U F) y/ L' t% q# x4 h
function checkform() 2 j9 X+ L- [6 I; f+ v% y
{ ( ?$ J1 v7 ^5 [4 E$ S- J( U) N
id = document.sform1.id.value; y' J# N2 x1 m0 a2 c+ r- _
if (id == "") # q3 p. R& @3 f( F' Q
{ # v; ?# M" x ^* B
alert("请输入注册名"); ! q8 ~# w' d( w8 ~' `% m
document.sform1.id.focus();
, a, s5 L1 ]" O return false; 4 ]6 r% g( O/ F" ?. \
} # H0 v$ K; O7 X: v+ u$ u( `& O
) T3 F+ j! `+ F0 d% |
for (nIndex=0; nIndex<id.length; nIndex++) ) s# P" _9 ], r0 i) a! z9 |- S
{
! r: V% J8 o4 j. ~- @1 ~ cCheck = id.charAt(nIndex);
8 f# l: z% K: ~; \- g if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
; y6 a: |! H7 E# y { ; g/ _* O0 P2 Y) ~. j
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); " W9 v, J% b6 ]. m
document.sform1.id.focus();
2 C. r/ E; g! Q7 G! Y0 D) [ return false; 3 i! K* B y0 j' K0 R1 B ^
} & ~$ i9 o4 m0 z1 u! d
}
% s" v/ R. A; g* V* R chineseid = document.sform1.chineseid.value; 5 s/ W* ]5 Q/ K( l$ n3 y+ j
if (chineseid == "")
4 L' n5 s4 }3 D3 \. @ {
7 |% X& e- m' ` alert("请输入中文昵称");
6 s, X* Q7 {5 @, O4 @- b( ^) r1 N6 n document.sform1.chineseid.focus(); & @# ^5 d- K; r; t1 q& }
return false;
2 g7 l* x; f* }3 G2 p" E9 B% W }
& d4 C- C( n+ w7 q. @ password = document.sform1.password.value;
: f5 g! @$ l7 N if (password == "")
0 U1 l# n( z% D {
- o! ?' e0 R$ {$ `6 {! _ r alert("请输入登陆密码"); % m7 {- s3 L# M; y
document.sform1.password.focus(); " Q! A1 ]& r# K8 {0 b5 d
return false;
0 ]8 q7 D4 c5 P3 v4 W5 W7 f: W } # T! K4 i+ T! x# {
password1 = document.sform1.password1.value; * C$ L* U4 a( u
if (password>password1)
2 ]$ n! s. b8 ?5 N. c, A {/ d0 f3 n* r! y( O' E x" C( t: q% p
alert("重复密码与登陆密码不相同"); 9 }! x6 L/ z+ ?3 f
document.sform1.password.focus();
?3 n9 q& { z document.sform1.password1.focus();
# I) ]! M0 \; |1 \1 f5 h$ R9 o return false;# q% q+ u% P/ k
} 3 t# j. |3 n- Y0 O1 \ m) d
if (password<password1) 4 s7 Z2 |* k8 B9 W1 n
{( W' @# }* m( U1 c7 Q7 Q+ L) E
alert("重复密码与登陆密码不相同");
& r# u7 o2 W ?4 p @3 o document.sform1.password.focus(); " C& @3 q. b/ Q
document.sform1.password1.focus(); ! Q8 Y. h* S4 C$ a
return false;, M* W/ y" H2 j7 l9 v- v! }, ]
}
+ r: V2 I7 w5 @& G6 d if (document.sform1.email.value == "")
( o. z! N2 x% S! m1 ] {
+ k2 e( f; x t! g8 } e8 w alert("请输入您的E-MAIL地址"); 0 g6 g7 D/ g2 a3 l0 i4 j- x+ @
document.sform1.email.focus();
6 @4 V6 @0 o7 H6 E# o( b+ @ return false;
$ R7 L$ z5 d" _ {/ L7 q6 F) a } # [9 I3 R Y/ U. ?6 K+ l
+ r( U+ [) Z: a email=document.sform1.email.value;
* G H) @( }9 C \3 p, @( b emailerr=0 " p4 T8 m! ~) H9 v5 U. A5 W3 S
for (i=0; i<email.length; i++) % x$ ?% n6 R: K- ?0 g
{
" Z; _+ s5 h5 Z if ((email.charAt(i) == "@") & (email.length > 5))
3 |# \0 Y( B" h1 L { ) g1 i8 V+ W- s2 k
emailerr=emailerr+1
1 O2 K1 g% w: ` F% C K }
~9 g7 C' z9 g% T" z+ |$ g } ( }0 p5 l8 A. G% p
if (emailerr != 1)
1 S- _, s/ I, s- |5 a+ T" w# ^2 @4 x" Q {
* V/ A4 B2 Y1 T# Z/ K) ~8 H alert("请输入正确的E-MAIL地址");
3 B' Z4 L* o: ~5 d& M5 a document.sform1.email.focus();
" Z7 A, U& S7 T- R return false;
3 U/ w- u& p0 u } 1 ~7 E1 ?" J( X4 a5 W4 U. m0 v
2 R: u5 f0 s: P& S if (document.sform1.checkask.value=="")
0 f+ f" d6 B. z& M& t' @# L! h k { . ~" r* R2 K6 v
alert("密码提示问题不能为空");
8 {* _; G. x+ M! V+ E5 J! A0 v document.sform1.checkask.focus(); $ z3 i& r2 l4 Z5 q
return false; 5 ~. c5 W# P; _; {2 r, B {
}
/ H9 T! H# [! F: ]8 n! m if (document.sform1.checkans.value=="") : ?" W9 P; R; p6 O
{ 9 B. t7 T C& o2 I; ~1 E" Y
alert("您的密码提示问题答案不能为空"); 9 Y2 n; }2 f, z9 e6 A
document.sform1.checkans.focus();
" P& F" `" x2 B return false; 3 X* _ B* P+ j3 `# ~0 j
}; w# n& D6 l5 w# ^# \
return true; $ g" W C# V) v; D) P$ q, j: K
$ Y t/ G* D6 h6 s5 ~# B} 3 s- F8 p: L r) p; y- ?
</script> |
|