|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14331
- 金币
- 2451
- 威望
- 1647
- 贡献
- 1399
|
这个脚本对你可能有帮助:6 b+ n# Z! s, ?* `. W! w
<script language="javascript"> 8 s% K$ M- J- j3 f& D4 T/ i5 P: |9 n
function IsDigit(cCheck) 9 Z8 |* w) c0 M4 r" _- Y
{
+ [# H: h1 f& d" \, V, a return (('0'<=cCheck) && (cCheck<='9'));
+ Q& M0 F+ |2 J- R6 L: F2 Z% _ }
5 S# Z9 S* }+ w
! P7 [. D0 f# v) ]6 U- U% F/ Dfunction IsAlpha(cCheck)
1 d# ~$ y% |) E1 S, `' {+ C1 X { ! J5 z" j/ G, B0 _' A
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) + Z2 u! U! w' o3 R* q9 q
}
& O0 r9 h$ f7 p& e: x 8 Z+ e, g: r$ p9 j0 Y& F4 m
function IsaNull(cCheck) 3 o( y$ U3 w6 T
{ $ T+ `0 d$ ?3 G
return(cCheck != " ")
& t0 B O( D) S6 A4 U6 ~/ h }
$ V/ C( }/ V8 p# c$ M' K ; \+ j! M3 w* T3 a7 b
function checkform()
9 p, V! p! g1 }, l7 L* P{ , c! y T1 d0 G5 h
id = document.sform1.id.value;
' Y N3 N- m! Q) R+ O7 r6 e if (id == "") # r" l) W. d. o* {. J
{ , T: C4 N! V1 s$ T( m
alert("请输入注册名"); , {6 M. `0 w) m& @! @+ C
document.sform1.id.focus(); * Z$ B' T: k- v' u+ ]% |- W
return false; 3 q& E) ?6 d- @8 [4 A
} 2 T# n; V2 q* {; t( }8 z
$ e4 G5 H, F5 f1 N( s8 ^- [( F% E1 a
for (nIndex=0; nIndex<id.length; nIndex++) # U7 y \4 x p T, \: d4 D! u
{ ' F) Y2 _" ^# R& H
cCheck = id.charAt(nIndex); ) ]6 ~ g# ?' I. [0 x+ g
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 5 A+ g: j* E7 {
{
$ a. T% ~, l- [0 i alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); " b7 k4 D) _3 q1 a# R9 \7 P4 I$ q, e% \
document.sform1.id.focus();
$ r1 R* f7 a3 r return false;
3 V6 A. S; L0 W6 j( [ }
9 @, \; ^' ?7 V7 u: h } $ P7 S, f" l; W# N
chineseid = document.sform1.chineseid.value;
0 g! f# V0 g1 J7 O' |. V* q* O9 g if (chineseid == "")
! ~: h1 a% ~; k+ @ { * o6 x, r, m/ A2 Y
alert("请输入中文昵称");
( }8 y" w/ c* t O5 K) ~" M document.sform1.chineseid.focus();
% R1 G+ K) k. b) D3 q: ]4 A return false; , J5 F5 n& j: V! s T( o
}
. B) R1 ^7 s, E. W" z password = document.sform1.password.value; : K' S2 T; C/ Q. Z$ B2 f+ K
if (password == "") 2 i, ?8 N# w7 I0 a. V" b1 _
{ # n6 E- `* P7 F
alert("请输入登陆密码");
) k8 y8 r: g! m4 {8 Q document.sform1.password.focus();
' n9 R4 p R& d return false;
z3 G+ E6 d+ k6 b# l# L/ s$ N9 B } 5 \1 t+ E i" q8 K& U: c' h
password1 = document.sform1.password1.value; 8 \' a& X9 |$ R0 ]
if (password>password1)
$ r8 n* Z- C, R! ]% A4 v8 c {8 e! i1 R8 Z! V/ K7 c' Y
alert("重复密码与登陆密码不相同"); " H2 t0 C4 D7 R# O. P$ ]8 q" b
document.sform1.password.focus();
( Q* Z; i2 k1 _' `" e, W* L! ] document.sform1.password1.focus();
" _4 n) W8 x4 a% R7 U return false;( Y, R1 ^: s8 H- c0 ]; u: h
}
z H( y/ M! ^7 l. rif (password<password1) ( F; s! r1 S4 S
{& t8 W( q" T) A- f; Y) }$ I% f; w
alert("重复密码与登陆密码不相同"); 8 }4 l5 T8 b$ }+ c% J
document.sform1.password.focus(); ! K) B: O, T. `) [
document.sform1.password1.focus();
. a# N0 t: m4 J1 I' m( i ` return false;
1 m. I" p6 ?, g4 ?3 @ }
$ h# ^" C M# m R, L: R1 a if (document.sform1.email.value == "")
* L# d4 f" O- e! K5 O' j L { * R) F, D/ q3 x5 B5 }, g+ y
alert("请输入您的E-MAIL地址");
9 X/ u0 B- G/ m document.sform1.email.focus();
7 y3 U6 J* {3 {+ @3 p return false; ; K$ f0 Z, _3 p _- P
}
5 s, p( T0 {: X2 g j& o 3 l @% U Y! ^" A& `
email=document.sform1.email.value;
S# q+ ~1 a ^) q emailerr=0 ! m# W* B2 g7 C' ]0 F# G" G
for (i=0; i<email.length; i++) , J: o& r/ I9 l8 U' Z
{ & n2 U1 w/ v8 j3 C% \
if ((email.charAt(i) == "@") & (email.length > 5)) . ^$ p" _% Y/ X0 I. P# i. S- Q
{
1 B% z) f- J0 h' i& n emailerr=emailerr+1
9 L# D+ t- f+ M9 ?+ c( E }
* n x7 X3 o/ E5 @) `$ G7 L } c5 W1 d' o7 H3 o9 J. w
if (emailerr != 1)
# A2 n5 z E/ W1 n { , J; I# J/ N2 }
alert("请输入正确的E-MAIL地址");
5 ?1 [- j9 H2 y B" O4 Y- Q% ? document.sform1.email.focus(); , \/ y* l @5 L0 N, n
return false;
9 X( F" M8 X6 }% w }
3 a, d4 d9 W! `) q2 h
$ o1 z" [* h7 Q4 }' X if (document.sform1.checkask.value=="")
, L, F& Q5 K- l, D { 6 \! k0 k" J9 L% e. D0 Q7 Y
alert("密码提示问题不能为空");
) T, @/ J+ N* i document.sform1.checkask.focus(); + y% ?+ L8 D" ]9 z0 v8 k. I. N+ T
return false;
/ u1 H' Z8 w2 K( i } 4 x" ^" {4 u+ J
if (document.sform1.checkans.value=="") . Z# n$ A- [1 k' R
{
, H. n! T9 n1 Q: ^% e, f: W* _ alert("您的密码提示问题答案不能为空"); ) J' ]* P+ ?* V% H u# V
document.sform1.checkans.focus(); ( x" a9 x+ O4 R0 e- Y
return false;
1 r9 n% H7 ]" z4 D0 y }
- }! a: m" P; Y2 j4 O0 O9 Z return true; + {9 a7 `6 \2 ?
$ t/ J1 N0 y( p
} 8 n* \$ ^% |$ ^4 P0 K1 t7 C! [& |
</script> |
|