|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:8 ]/ _' F4 V5 }& N# g
<script language="javascript">
# W" u7 _, L7 }0 T9 ^: t' Yfunction IsDigit(cCheck) 9 H* B; M/ p2 m s* F
{ - `+ n; m" R% }4 y: L/ b
return (('0'<=cCheck) && (cCheck<='9')); $ \- |: e' B) |, ?5 G! }6 |
}
4 K0 c1 @0 D K! m' Z
* E+ `# Z# K# V) n4 ?* K* ifunction IsAlpha(cCheck) + m# A( ^& a' B# K9 \" ?2 P
{ . X) c4 k( H# W0 w( S1 J$ f) y# G
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . ^2 _, Y& }2 S0 n. B
} 5 ^% d; p' s0 j9 i- _9 l4 q
1 B9 ]& t0 A/ L; ?
function IsaNull(cCheck)
) }( H- q1 Y. L, U$ R: p" _% w { 5 ` T% y: a! d3 j
return(cCheck != " ")
1 d2 O; t! q+ K9 s/ e }
+ c" R, {# ~! q" t c 1 g0 ]7 X* Z, a) B3 ^5 n
function checkform() 8 ^0 c/ v2 i1 a# G
{
! D) G# B* E8 i9 \$ U6 [, z id = document.sform1.id.value;
: `+ f/ y4 m) x# b o$ g if (id == "")
% a% e" N* j/ n! o& X/ `* D { " J g9 M( |3 j% B# m& c
alert("请输入注册名");
# `! K! }8 {5 l% ]7 r' } document.sform1.id.focus();
2 v# r" b' x; v! Y* k1 h# O return false;
8 a% _# y' w6 d% T }
/ w1 n7 @1 _. `5 t
, l: O2 }8 }5 s8 U for (nIndex=0; nIndex<id.length; nIndex++)
4 n! r' Y2 n b/ P0 A { * Y# ~$ |, O# C" Y" D
cCheck = id.charAt(nIndex); & t+ \ i4 z, i, D4 y
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! t( C; _) t# m4 T; a3 V, }
{
( C' f4 U' [8 r- |+ l alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 4 P5 P+ K. B8 }9 ~
document.sform1.id.focus(); ( e. d* b7 y4 K0 N0 f. [: r; b/ b
return false; ! u) @" @9 K% h$ W4 T0 l
}
1 W0 g+ U; X" b o [' \ }
+ @5 ^, r+ {( A chineseid = document.sform1.chineseid.value; 0 k/ x" J: G/ \
if (chineseid == "") , D6 t5 I1 \/ Y( {3 w* c( c
{
$ K9 t* A: y C7 b; A! v7 H alert("请输入中文昵称");
( T' o! O) {! E4 D4 ~' [' y5 Z; m1 R document.sform1.chineseid.focus(); 5 h& M- ]8 v6 K- c: H
return false;
! l, ~4 w! G. ]1 x; ?1 Y9 c$ g7 K }
: V) {6 S+ {& @+ A8 f' T password = document.sform1.password.value; * W: U* _7 c5 _& G; `8 v
if (password == "") + E3 T+ K! Y: q$ [; w
{
& u% E9 ~4 J$ [1 f' o9 r ?- P alert("请输入登陆密码");
4 p* S* X" e7 D document.sform1.password.focus(); 0 L' G$ M0 d4 l2 }- l4 V
return false;
9 V3 _$ R" l% i# N g; I }
% A/ r, \' u$ G# N0 h7 R: K5 e$ B password1 = document.sform1.password1.value;
, c5 s2 Z$ J9 e x5 Z0 J if (password>password1) - \7 V; v1 i7 w7 e3 S
{
# M' ^% g, Q2 X5 y! Q alert("重复密码与登陆密码不相同"); / k( @5 C' B7 D! h
document.sform1.password.focus(); R0 A5 t6 e$ s8 q9 w: R2 Z
document.sform1.password1.focus(); # _1 r& K+ s% Z! U$ j5 b- |
return false;7 y: q [* e8 M1 N8 G/ x
}
& ]6 F3 E# G7 P8 d) L$ a/ D4 Qif (password<password1) ( g: d( R+ m) w' t! c) }
{9 \5 C3 }2 c1 E; b7 L* D
alert("重复密码与登陆密码不相同");
0 M7 P* @: s1 C* K1 V document.sform1.password.focus();
. V4 N m% l v4 y, L6 M document.sform1.password1.focus(); . L T8 Q3 z9 q
return false;
7 {! l. n- M z9 ^1 Q8 `3 q }
3 y1 m4 B9 I! ^ if (document.sform1.email.value == "")
2 S+ Z6 I% N8 p3 \% a! {+ H { ( F t" N, W; f. A
alert("请输入您的E-MAIL地址");
. Y9 C; K' L" o5 ^! P* f document.sform1.email.focus(); : T p! o, ?3 C. y) S
return false; . P1 ^$ ]& t3 G" o5 q% M; C& B1 Y8 ]
}
. V& j1 y. y9 p: P# m; b
, c; W, l9 R9 }' z3 X/ U email=document.sform1.email.value; + E- {4 R1 I2 b' P4 m+ t: X' x
emailerr=0
& M/ P# W* C3 @5 [7 ?# f for (i=0; i<email.length; i++)
; z- |& a z1 d/ U {
* c! [6 [# V: B' e$ g if ((email.charAt(i) == "@") & (email.length > 5))
3 a* h5 Y. W" Q5 e {
8 X0 \1 i$ U# P( o! z/ `, y, m emailerr=emailerr+1
' e7 [: W1 C, [, t } ' L3 |3 C @; H( N' z
}
' m' e4 M4 V6 n5 k9 h if (emailerr != 1)
! n/ b0 X5 T1 |' b% H {
: G: O. R' d7 Z% l alert("请输入正确的E-MAIL地址"); 3 U# C' W6 i* k# C
document.sform1.email.focus();
1 C$ N- T) r4 w- N+ c8 ]( ? return false;
8 Q& D3 u9 ~9 a7 x- r( E } / Z; W: d( Y! r2 k9 B2 n# A) [7 k
& v4 h' H$ e+ K! q. V. U if (document.sform1.checkask.value=="")
# y8 K! H ~5 ?5 ?4 c& u1 L! y7 |% k {
- o' h. \. X0 ?: O/ B- @ alert("密码提示问题不能为空");
9 @( g2 T' b# C* k/ S' a! J K document.sform1.checkask.focus(); ) W" ^/ K; ^2 z }
return false;
$ _$ c* d) u. @ }
( F( V# C; I9 x( [; T if (document.sform1.checkans.value=="") , \' m9 I- @: `4 g7 @
{
. f! m& Y+ P& l; N& h c alert("您的密码提示问题答案不能为空");
, ?7 b7 J! W) c3 W `& ^; M9 y document.sform1.checkans.focus(); # r0 ~ f- g, K
return false; , p, ~) }- ]" o4 E$ S$ I
}
8 T( d, B3 c, J( `4 l. V; |; V! w return true;
$ X7 t' J. W3 s0 J5 T
, X( C$ X* B9 G} ) `: \5 V- C) ?; H$ j j ^
</script> |
|