|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:# `$ M0 y+ ?6 y6 u. E$ W3 J3 @
<script language="javascript">
2 z# X6 {3 G' Rfunction IsDigit(cCheck) : x; `: l: P2 ?+ ~
{ , j: H' a2 r* L% @7 P% S
return (('0'<=cCheck) && (cCheck<='9'));
$ R2 }1 [- v9 o. G, M8 q0 O }
* w& t2 B7 P9 i% w% T& F
4 j* o9 ]: s Qfunction IsAlpha(cCheck) % D" H' }0 m) `' H. h$ l0 V0 P
{ + O+ U/ y3 j) {) h; A' {
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 E y: A4 E) I, F6 C1 I9 j
} 3 z& O# s- ~4 {3 u; _
- D: `' A# X8 }8 Q+ Q2 ?function IsaNull(cCheck)
( }3 n; J# @& Q4 _( O6 D { , o! p W; r9 Y' A* }# I' B' S: t
return(cCheck != " ")
2 r- L; m) s5 ]' r- Q4 N+ J. {6 }% Q } ' \. z f5 m/ [2 n$ M- K
$ A* s0 J* }2 U: X
function checkform() 4 n4 K! u N* V5 x5 d, P$ x# G
{ 9 |% T1 a( B8 o1 b) A% h9 l
id = document.sform1.id.value; $ p7 _4 Y, ?$ i$ {2 |
if (id == "")
4 k2 G$ @0 \' n { 6 p, U [- K% A+ ]2 _; [$ E2 C8 k' C
alert("请输入注册名");
5 k; v3 ?, r. v# I# A6 }9 W document.sform1.id.focus();
8 o! R7 W& r7 `6 x; x! L3 S, ^ return false; # Y4 o2 c; B$ Z5 ~5 q8 m
}
4 {* H0 |! W, h
; z( Z8 E" g3 ~6 t for (nIndex=0; nIndex<id.length; nIndex++) & ~6 z( j: [+ W$ c9 l
{
/ E) A7 f( @% E& B' K/ ? cCheck = id.charAt(nIndex);
1 ?+ S/ {2 w% K/ ^& F if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) . S c- k! M% \: o- |$ n+ [
{ 9 h$ h5 F( m) A" y
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' G/ J* Q3 @7 |) C6 y
document.sform1.id.focus(); 3 |9 c- t' W8 }9 ?4 ?5 E
return false; / j) o4 N- z; R, n
} $ U* E1 Y O* M6 M, D6 H- B
} * k3 n! K8 @: Z5 [
chineseid = document.sform1.chineseid.value; 9 h) Z" M% Y' X3 l3 H7 k1 P
if (chineseid == "") 0 O/ [. o. U7 W, _, z; P! O6 q. v
{ ! a& g" J6 m9 v0 G% M9 e; Z
alert("请输入中文昵称");
" u% q% \& e; j document.sform1.chineseid.focus(); 0 M4 x$ |! ?& \# r: O
return false;
# ~( b- Y( r, G7 V' T8 q: A }
H$ J! f# {3 ]! R& F! M- F password = document.sform1.password.value; + Q+ S A2 A5 ]& O; E# `6 u
if (password == "")
/ ]. K3 W2 u" r% ]% a3 D6 j { ( c# y/ s- f6 P4 ^$ i: S3 H
alert("请输入登陆密码");
9 A7 w! {1 F1 |5 n1 _( L document.sform1.password.focus(); A6 G9 F4 B0 u( |
return false; 0 `' P0 F7 g# P# L
}
+ ]1 y+ P6 ]8 @ password1 = document.sform1.password1.value; - w0 A" D, n) B8 x
if (password>password1) ; b! i: k7 ?: z
{
. ~) n. Y% {) l& ?. a+ T alert("重复密码与登陆密码不相同"); 7 o3 A; G) l, ~, \2 ?: z
document.sform1.password.focus(); 6 N- B' s! Q5 k
document.sform1.password1.focus(); # w4 ^$ v5 d3 U, |7 m3 M
return false;
2 z9 |; |) j& F; | }
1 F# R: F& c1 x+ s* k- b2 eif (password<password1) ; M& Q- O8 k# d
{$ J0 \ c& E5 R7 s6 @
alert("重复密码与登陆密码不相同"); ! }, q; Q2 ^* g4 m3 q" b0 R# r. A
document.sform1.password.focus(); & D, c( Q, j- e- B( J
document.sform1.password1.focus(); % B5 N) ~: f* o* |8 u3 S b
return false;6 L) [( H' b9 Y; j, i
}
: `- g3 w3 O; w/ j( }: ?. x' g if (document.sform1.email.value == "") 9 g; x' G4 A6 d4 w4 B8 z
{
. O. E0 U& s. Z' L2 P' x% H alert("请输入您的E-MAIL地址");
8 _/ A! `; P! v+ z2 D7 I document.sform1.email.focus(); / j6 V8 l0 j% r& k( D( o
return false;
3 u5 W/ c* s& b% | }
) K {6 w p4 k N
$ _3 u* K1 w& Y$ Q email=document.sform1.email.value;
$ v2 h- A: }, \ emailerr=0
, t `$ n3 w Q! e$ J for (i=0; i<email.length; i++)
/ N) Y0 P( s# p0 a& r7 u {
$ s1 A5 J, X k8 _; e& G if ((email.charAt(i) == "@") & (email.length > 5))
# Q3 U' D0 H; ~$ {0 R6 M0 y1 V7 l { 2 a, n4 j1 b j/ z7 e& ~
emailerr=emailerr+1
1 N; K, m: z) z9 h }
# _1 w+ e: ~* P0 o }
' G2 J" Y2 I+ z$ ]8 s. [; L0 s if (emailerr != 1) - ~, `; ]0 x" \
{ ( S4 H0 p7 v7 d
alert("请输入正确的E-MAIL地址");
0 \7 `, k' q3 o1 p$ s/ w# E" c document.sform1.email.focus(); 9 a+ n) ]- `% B; B3 K3 u
return false; + f- s* q5 C0 ~- i) i
}
, z/ E. e+ V! x- U
) o, r( \1 O5 f( S if (document.sform1.checkask.value=="")
! \+ P0 I/ v/ [! @6 Z" S) i/ ^6 D$ n {
* }3 p& v# ~# d& r$ H% e" s+ [, g% q alert("密码提示问题不能为空");
( z' K" u* R; G- z* g# H c document.sform1.checkask.focus(); 1 o# ~6 J6 i# [0 M" [
return false; % R8 @4 C6 ^( U( K4 |# X z
} W7 B+ J( ^; L% w# S2 s9 C m0 K$ f
if (document.sform1.checkans.value=="")
& }* Y3 Y8 S# t1 @: z/ E4 J { $ [$ q4 V" J2 H; c- P
alert("您的密码提示问题答案不能为空"); * v1 {7 h, G+ {, H) s M
document.sform1.checkans.focus(); & ^7 K8 `, U+ b: U
return false; * h$ `) ~6 A: F8 K* n' D) L
}
# P$ F" o0 K" f6 R return true;
" h) j% g' _0 u7 D ! m C0 g4 j& W# a, A; w
}
) c( E0 m: r" L" w2 t! n+ A</script> |
|