|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:
8 i" y7 q0 C5 g) m( q$ a& ^8 F1 p) A<script language="javascript"> 8 z3 ^- n( P: Z- ^. q
function IsDigit(cCheck)
3 h1 t0 p$ \* t+ Q6 t7 d5 Q { % h/ `/ _; |3 u7 |5 A0 c$ e0 N# K
return (('0'<=cCheck) && (cCheck<='9')); + }% ^8 x! Z( r% y- Z/ m& K# |
}
4 Z' f5 `; m5 h9 n4 f& n( W 5 n% \2 w4 X1 i8 S' g9 L
function IsAlpha(cCheck) 2 p3 k, g- f. o0 W! Z/ C) E, l/ k5 g/ ^
{
3 v% o' m; A/ a! u% ] k# s return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
- ^- P8 c( }+ f3 b& L }
: n0 @/ W2 S* W4 o* L6 \! M) r7 d- b
1 |6 b# g$ }! ?) Afunction IsaNull(cCheck) 5 C0 X- b& r5 y0 B
{
' U; q# I% d' d; R return(cCheck != " ") ) }2 Z) c2 t$ r8 ^
} 7 U9 `: W s8 H
. P: Z; y8 i( l2 m5 }
function checkform() . \: Z/ n1 A* n3 {$ c& A
{
/ ^( I+ z, Z! ~* [* {* @9 q+ t/ x id = document.sform1.id.value; : }2 ]' V3 X% V
if (id == "") 8 d& Y3 Y) Q0 |, O
{
' N6 u9 E* k- _5 q$ W8 E( r alert("请输入注册名"); 2 m1 k% x# c& ?
document.sform1.id.focus();
9 M6 I: F+ e5 u/ a return false;
/ a9 m) x# w8 t0 Q, I } * A1 x3 U& r9 c) b5 D5 a
% G& \' Y, G8 H; E for (nIndex=0; nIndex<id.length; nIndex++) f3 R* T6 `( e/ s) k
{ , r$ ]$ _! k8 m- k, O
cCheck = id.charAt(nIndex); ( G- h7 ~$ n- g; K( V$ [* X
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
0 k6 A4 X% f- n2 _9 g. z0 n2 j {
# q0 @- w9 k9 k alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 1 }7 r! `) _) P: |9 p
document.sform1.id.focus(); * o" k1 X- t- r+ v4 ?0 O! \( ]
return false; * w) A7 ]0 n [
} % k" o( e/ N3 Y7 J P, r7 c$ ~
} 4 i7 n R9 u+ U9 D5 h
chineseid = document.sform1.chineseid.value;
, E) J2 V* [$ ~0 S if (chineseid == "")
9 h+ ^! N6 d7 i7 U {
' Y- g5 ` O" M% }3 H7 f& q8 s alert("请输入中文昵称"); + m# R; l: n/ C- {( a, l' x) f. @
document.sform1.chineseid.focus();
0 I; A1 L' K+ W4 |/ y) Y) y8 E% { return false;
$ w4 P3 H; L @# ]: e } 8 h% I- I, b' c% ^
password = document.sform1.password.value;
5 W' A7 ]2 y1 n/ }$ _ if (password == "")
& \ _0 `( x+ i/ q {
1 l1 \1 Z' B9 V9 s3 b alert("请输入登陆密码"); + C+ @ s3 O7 {4 D, u
document.sform1.password.focus();
* n7 H/ Z4 [6 Z5 J2 e return false;
6 s; N* N; r- @0 u | }
5 Q7 h5 D( A' _$ q* x password1 = document.sform1.password1.value; ' l$ W: Z- d7 R
if (password>password1)
2 D& I3 C8 ^- k {7 o7 u' k/ H& B8 c" t8 O
alert("重复密码与登陆密码不相同");
8 ~* R+ _5 _' T+ `, S document.sform1.password.focus();
' L% g+ G, f$ K$ h# J% ^ document.sform1.password1.focus();
4 S) y1 m# P D. f, P- y6 g h& P return false;% L4 u$ R/ @8 d* c6 ^, C
} 9 _6 X8 [' M; J9 f4 [5 V- |
if (password<password1) 3 x; { F( d4 P$ p! k" @
{
4 p& x) L% Y# _$ r; b alert("重复密码与登陆密码不相同"); ) o6 P' S8 S% t) l ?' V
document.sform1.password.focus();
' y$ {; ?9 J; q7 v5 M3 z8 ^ document.sform1.password1.focus(); + ?7 E* G& P* R I
return false;
- X+ \5 W1 t+ [0 f- L } / t' r( }. x5 y7 P$ U5 r
if (document.sform1.email.value == "")
2 l7 k& R6 B, ?0 `, r3 C { 2 E/ h* W1 o/ e" a. R) B8 e
alert("请输入您的E-MAIL地址"); 4 g% ?! B* n# D6 v
document.sform1.email.focus(); $ J3 Q7 S" o$ Y9 C) q
return false;
Q6 k- |9 r) \" T. b }
5 j! \# j* W" }/ v
1 b6 }) H @9 n! M( F5 c8 g email=document.sform1.email.value;
/ z- R, d0 x6 ~9 j emailerr=0
, w! S# v9 }) w8 q! M" r( Z8 ` for (i=0; i<email.length; i++) 5 ?6 q, k2 S; C
{
$ o1 X/ r( X6 e% C9 ^% F2 J if ((email.charAt(i) == "@") & (email.length > 5)) ; k7 W) n7 g0 r
{ * o. l3 l) [5 h) u
emailerr=emailerr+1
$ Q- s- a- ^+ P; G' u } 9 O$ P }% Q2 [ T
} 9 ?4 Z3 G; m1 B7 }4 C, k% v2 p" E) K
if (emailerr != 1) , H8 S e$ V: p. M5 D
{ 5 R7 ~- V/ j( n4 f8 d( F3 c
alert("请输入正确的E-MAIL地址");
2 b1 r: p8 E9 o8 [ document.sform1.email.focus();
) b) U6 V7 G' [5 [: E4 q$ E return false;
5 U: p: O7 d/ N% w3 Z# x$ N } 9 [1 `6 i) ^+ \/ c2 j
4 K$ R X+ \* m8 y8 ~! T5 y if (document.sform1.checkask.value=="") ; F7 Y' i. V" q, J4 C4 L+ a" o6 o
{
4 G4 Q6 r% q/ L7 R3 G alert("密码提示问题不能为空");
! [ i# X( v6 t* N4 B& I. E document.sform1.checkask.focus(); 5 b6 N5 u% V/ L
return false;
' _0 |& c( p( T, {3 K& d s } 2 [, b8 {% c2 H9 ^/ x/ g
if (document.sform1.checkans.value=="") ( ^* G$ \# i6 y. a- E( t
{
. H! U) `% ~3 p, u alert("您的密码提示问题答案不能为空");
& H( |9 \! C* a3 I4 u5 E& l document.sform1.checkans.focus(); % p2 d' F3 x$ D5 ~8 W6 f
return false;
# N6 m8 {$ C0 U! ^: z }# i$ o/ J" d5 d+ {" ^3 m+ m6 d
return true;
- z" _' a3 K X) A8 i) j' d3 V2 r' X3 | / D* n4 h2 ] `1 e3 b; Y( ]5 U% P: F
} 5 u4 b* F3 z R0 W
</script> |
|