|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14437
- 金币
- 2504
- 威望
- 1647
- 贡献
- 1452
|
这个脚本对你可能有帮助:
6 u6 D% T' a4 {; n/ i% x( P- S<script language="javascript">
! V r$ u5 S b V x+ ^3 B$ cfunction IsDigit(cCheck)
( J0 d% S/ T% @) a- _ {
7 `% w G5 i, m3 C5 e return (('0'<=cCheck) && (cCheck<='9'));
& K% ?6 p3 E$ B, W; y6 @0 P }
" x" v5 h- _. e/ m0 p n: p
( h2 }7 T1 k, W0 y ` ~2 [5 l) L2 Mfunction IsAlpha(cCheck)
. F" d7 r% n$ k { ( {) h! h# C. w- o1 P
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 j; H+ c/ v4 b" ^+ v' S( `* a }
+ H5 b& J0 }. Q9 Z" }8 Z7 ? : u, T' T) r& p( Z$ s; }) j
function IsaNull(cCheck) 2 z. Y' c8 b1 @% u) q! S; z
{
( M" P+ y: a: N x5 c" q4 H9 A/ F J return(cCheck != " ") 1 o. p! ^ _- k$ k' V
} + I1 n- B; m" r0 w( [- b2 o0 S9 h
) z7 Y2 f1 z4 {
function checkform()
1 @& g; y5 t% }$ s0 f& S7 J" V. V{
7 c5 t8 T( }6 ^$ K6 w/ J id = document.sform1.id.value; 4 \ {0 F" u+ l) ^* c! T
if (id == "")
/ X" _' {; C- F' x { 8 h$ `1 L! M. x8 x7 X5 b2 ^
alert("请输入注册名");
4 s. W; m3 [8 q3 v, @9 X/ } document.sform1.id.focus(); / f- |8 }% x {( E
return false; " e L/ l4 b6 ?" Y0 q
} 9 }/ d% }* k, t; H; n
9 @/ x7 u" A5 Y, W6 |# F, o for (nIndex=0; nIndex<id.length; nIndex++)
: g& [1 [' o" w, r( | {
- X% p9 y7 Q, D% ?9 b: C cCheck = id.charAt(nIndex); & P! e9 T& r' Y2 p, r0 h* f
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
4 e7 S( D7 l4 Q3 x' b8 F( `: \5 I {
$ E- ~% V) F9 y0 O1 }! }7 m, | alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 5 e% w. d% R+ y6 d% r% z0 i
document.sform1.id.focus(); # b; ~0 D5 g0 ?& `9 z
return false; ; X1 A, U+ o3 |
}
% n2 c' s$ D" Z+ B2 ?1 i+ ? }
: B c7 L+ z" u6 D chineseid = document.sform1.chineseid.value;
/ G5 A, W: ^- R0 n- B3 J& J+ S if (chineseid == "") 9 r; Z7 T' g6 d& _ c& R
{ + N- \7 s: C8 F7 c
alert("请输入中文昵称"); ' F l. M9 P2 a: z/ f
document.sform1.chineseid.focus();
' r" D8 @0 ~4 v6 T% ^) b- g return false;
0 R9 g" V% l6 G- u1 w }
8 i- {/ ^9 _7 Q; b9 X: H9 y password = document.sform1.password.value;
) v2 S% _1 C: Z if (password == "") , \$ K# X& p. }" [
{ 9 R9 Q$ i1 {& }% c/ x6 x! v) \( y
alert("请输入登陆密码");
/ s( `7 x" d' t, H5 } document.sform1.password.focus(); * ~+ a3 C* e" r1 |/ b) J1 m9 D3 S
return false; 1 {7 \4 }7 r. u, ~2 I
} 2 d; l6 F& W5 `5 j
password1 = document.sform1.password1.value; ; }' Y2 d$ F/ _/ I- x
if (password>password1)
: a/ S2 e5 G- |/ T7 p( v l. i {
# U& {/ |( j+ h I& } alert("重复密码与登陆密码不相同");
$ X q+ U6 ?& H$ _. n7 _7 G document.sform1.password.focus(); & c5 c8 `$ b$ K2 L
document.sform1.password1.focus(); ; ~* R6 s' \( L0 M
return false;' P& I/ l. y* h8 `, A5 T
}
( M5 m1 b; q7 Q" k) f* R mif (password<password1) % _( `, c# N" v* p
{* T8 j3 Z8 K- q
alert("重复密码与登陆密码不相同");
. m: J; U& p- Q4 y document.sform1.password.focus();
! p7 \( W' k# \+ l1 q0 O: h document.sform1.password1.focus();
9 X) G9 z, |' T return false;0 h7 p* H9 s% o9 j9 ]' \3 S! I
}
! u7 B& C! ~$ `. {3 a+ H7 g- w! U$ o1 z if (document.sform1.email.value == "") _' @9 Q. x1 x9 C4 T
{
6 ]& s9 |/ h9 g6 H$ ? alert("请输入您的E-MAIL地址"); 3 L, j" W" L- D( ~
document.sform1.email.focus();
/ t* P; k+ G6 W6 @) l. H2 f7 T! N return false;
/ X+ K! Q, ]! @ p }
* ~" c' u/ I7 ?& O% O3 e' A2 ?
' d; I) H! Q4 ]' d$ Z! z* y$ I email=document.sform1.email.value; 9 x! ~7 \6 ~: ?. f8 I1 `
emailerr=0
8 F% g& ^4 q+ a: P6 s# {. n for (i=0; i<email.length; i++)
: i! Y- @2 b- M { 7 |+ F( V- p0 D! u
if ((email.charAt(i) == "@") & (email.length > 5)) " e" W3 W& c7 f, j# M1 U$ ]* b, {- z
{
; d8 F# I4 K8 ]9 l/ u emailerr=emailerr+1 2 z5 u) k* T! k7 i9 d F+ ]7 w
} 1 n. A- d9 y) A2 i7 B
} 7 ^' E" f" Z$ z' o c0 V6 D
if (emailerr != 1)
, n. @5 F# b# C7 a3 G {
9 s1 @- ^* f' m$ K alert("请输入正确的E-MAIL地址"); 6 a0 L% N$ A' A0 {! k; w j
document.sform1.email.focus();
U' ^, u3 b1 d( k: o# m return false;
: i+ M' S# H1 F* c( x, h }
8 y5 l- _4 f2 O, Z. B 6 B2 Q) ?. J8 m, ~- s
if (document.sform1.checkask.value=="") 5 l1 |3 `5 }/ y( Y2 Q
{ 7 L5 [% H/ [/ i) g, {0 a; K
alert("密码提示问题不能为空");
6 w8 b3 b5 Q+ n7 J" F document.sform1.checkask.focus();
+ O2 p4 t7 H$ @( Q0 D3 E2 \ return false;
. A/ Q1 P4 s4 ^" x% `+ S } ; J- L) d! k2 y" ]* c
if (document.sform1.checkans.value=="")
2 |& n* r3 s' d+ I" p: j9 A { 3 c; x f: h0 Q6 u7 H% ^
alert("您的密码提示问题答案不能为空");
/ M" f! f" V3 b document.sform1.checkans.focus(); , q1 V9 R5 J; \6 D4 M: Y4 H
return false;
; S, b9 L/ y v. d }
4 m1 n: a+ p: }( ^ return true;
) Y7 W9 a; t C" O& l
+ q/ Y, h! f5 N% G- o. q1 \; A}
p: p; T3 z E2 ^6 O/ ^; ^! B</script> |
|