|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:: @2 N* E- ~% L! p, i. k
<script language="javascript">
% [: s- g c- _* lfunction IsDigit(cCheck)
% I8 y" Q5 H4 g1 k) W- L5 u+ U {
# H2 |1 V6 A5 C1 U7 y return (('0'<=cCheck) && (cCheck<='9')); 8 {2 I# p; P2 @* g, R/ g$ E
} . A5 d+ K) n, z5 q/ p! E$ q
2 v! V* ]. |* u" a" O3 \, _# E2 @function IsAlpha(cCheck)
* u' ^0 D1 }" ` {
" T9 m& A0 c, j; B1 Y+ T# p return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
$ o+ e9 A! b: _3 l5 D4 z) \; D } & j1 \4 \, M# ^" M% a0 |
% s" k3 T, }# z$ W' q
function IsaNull(cCheck) ; a$ F- J3 o X
{
5 S2 O; U3 x8 @4 `, g return(cCheck != " ")
. |4 A3 K4 u, |) d& j+ P$ D }
) \8 ^0 }" {$ R: e
3 x+ d! b( m1 e; d9 Hfunction checkform() * n% o. K1 R. n1 [
{ 6 G: F, G: ~8 X8 a
id = document.sform1.id.value;
) ~3 u( c+ [8 g) R' Y& b* | if (id == "") 5 ]6 L& n" ]1 Q4 [0 j5 S# l
{ 1 o$ \' q; y, k# Z& ]8 y3 E
alert("请输入注册名");
0 J D: L, M, P$ Y+ y- F# X) o document.sform1.id.focus(); 6 \' b9 J& n- g+ Y
return false;
3 Z1 h6 V7 q# U+ @0 I7 e } ' [1 R& a' b3 I- @
( `. r; q$ d) z4 d
for (nIndex=0; nIndex<id.length; nIndex++) ) D+ B0 B2 n9 c( B
{ " L2 L5 l; s( i+ u. o
cCheck = id.charAt(nIndex);
# R; s; Q* W) ? if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
4 k# D6 O3 H0 J3 V) G { 3 u) e3 k- r/ {3 C9 x' L
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
6 b: Q) u0 R+ H' G" D( t$ d document.sform1.id.focus(); 0 g) o. r% V' f3 @8 t6 m3 u
return false; ; Y5 N/ U; ^ O% ^ C
}
' @$ c0 ?5 H- e$ y# k9 X/ n } * r- @! _8 c9 e% C4 T, _6 c7 m
chineseid = document.sform1.chineseid.value;
& H. I+ H5 Z' E) M* C. r" V; @9 ^ if (chineseid == "")
5 O! @; k( x8 L, H& W0 d+ U { & v7 f; L6 o$ ]7 k, l
alert("请输入中文昵称"); 0 s. K; R4 |7 X I! P0 [ L
document.sform1.chineseid.focus();
. L* d! b: O E7 S7 V return false; % H; j4 ^) j2 A0 T$ s: l2 C
} 9 K$ c! e: a; q; g" z
password = document.sform1.password.value;
* _; Z3 i- P2 R4 | if (password == "") / |/ k, @7 m9 B9 Z) |0 h) S
{
2 W- y3 [6 w0 }. w" Z3 g# o, E alert("请输入登陆密码");
0 m5 e" m2 i) _ document.sform1.password.focus(); " ^9 X% m7 b% ?
return false;
/ B$ h, `5 \: |6 \( G! D7 l } $ |2 f. X# ~! @7 O5 ^0 ?
password1 = document.sform1.password1.value;
+ X- K* e( @0 l/ z if (password>password1)
; W2 `' i- _1 n: \* e) J. s {
2 ^! R5 f6 _6 S1 V alert("重复密码与登陆密码不相同");
( f. r5 R* t$ Q/ q9 a+ z( U document.sform1.password.focus(); 0 q* p% g0 O; \5 F; `9 i, _1 {
document.sform1.password1.focus(); ; b+ M# I9 q" s) O4 }. A5 X
return false;$ T# p, H: L, H
}
; l, t, f; U" eif (password<password1) 1 S2 F6 }. |6 T7 ? S
{! w* y$ K- O% y0 w1 d' u
alert("重复密码与登陆密码不相同"); 2 h G. [# J6 y. m; _
document.sform1.password.focus(); 2 `1 i8 o; K w% K& J& U4 w
document.sform1.password1.focus(); % X; k' |# l- f
return false;
6 h0 T$ m7 v$ d, F5 h }
: l% R. }. k& @$ F/ U2 X; y if (document.sform1.email.value == "") 6 v; _: k4 \+ j( ?# }1 L* [
{ % Z4 j _8 h. r7 q
alert("请输入您的E-MAIL地址"); 0 D5 u5 t( ] T0 R N
document.sform1.email.focus();
9 m* p% S N$ Z- d- y return false;
8 }# ?' _3 o) i' k7 H/ b }
; e1 H9 h3 m8 v7 j0 O
6 \: G% B" g/ \2 s% W email=document.sform1.email.value; 3 l3 {' p! b$ V) }
emailerr=0 - T1 M' n. p! p. E6 C
for (i=0; i<email.length; i++)
e! V$ S/ r; c/ v3 c( \0 }% p! c1 q+ F { 8 R8 e% o _3 I A0 O
if ((email.charAt(i) == "@") & (email.length > 5))
/ R7 M6 A+ w7 T" Q# }# _ {
) E+ {: ?5 \# k8 D' X; T( M emailerr=emailerr+1 6 A9 P4 Z$ a, m
}
6 `8 k- j! J2 G0 D9 C: M }
& ~* L3 y0 y- c' J' L if (emailerr != 1) 7 R" M! v% b3 ^9 x5 P# O# F* l9 y
{
: r/ i0 \ I; {8 ~2 P alert("请输入正确的E-MAIL地址");
5 k5 a7 |: Z( G( O; M/ I document.sform1.email.focus();
, x7 j. Y8 ?+ ?$ R return false; * u" B/ P2 G1 P$ S* Q
}
8 u7 H( v V) D. ^& v5 d , Y% q! p& P( l3 b0 J
if (document.sform1.checkask.value=="")
$ J8 L4 C' |8 m% N! Q { - W" w8 f- m1 N$ n7 f% b
alert("密码提示问题不能为空");
. d6 D% G# u3 ~8 g1 E v* T) G document.sform1.checkask.focus();
* N8 r' D% N0 h6 a0 p6 K return false; $ e* [) f/ T! m: _5 f
}
$ J3 C' _2 d- y6 S if (document.sform1.checkans.value=="")
( ^% H5 r7 n0 {: u9 d {
5 B& u7 y# R1 x4 X alert("您的密码提示问题答案不能为空");
# b5 Z$ n9 D* W N+ t* O& Z) P document.sform1.checkans.focus(); * Z! ? z$ @5 @; B k+ i
return false;
1 {; w7 O7 `7 @ A$ S+ o b; M }1 B& Q3 m7 V5 z$ b, B( o
return true;
3 H! g' y ]( A
2 p6 Q- c! h# w) d& F2 q} G9 `' {: I" ]- g- g
</script> |
|