|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
这个脚本对你可能有帮助:: t4 V. o" K% n! M: ~. d! Z
<script language="javascript"> 0 i+ g. U7 [7 G# y8 A) }6 u1 `& B
function IsDigit(cCheck) ; |* B3 n6 J% J; n6 I
{
! \& E+ r, b5 I8 t) N1 N return (('0'<=cCheck) && (cCheck<='9'));
* O' |3 m& @. N: S } 8 e' h7 B5 C2 I8 G
& m G$ z' A, G, d$ D
function IsAlpha(cCheck) * j6 ~; f" P2 K" d4 L3 {8 m3 m
{
1 z \2 U( T Q Z7 R return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 q, {- c7 v3 }* J" A } & o1 ]4 P9 H; S- ^ \: r& m
1 ?4 F& l* a: v) c
function IsaNull(cCheck)
4 H* e; |- T& W+ Z, |; F' C {
5 h' l+ ]" u s: E return(cCheck != " ") ; V7 h( g: H. c3 d
} . ?6 Y" W% [* Y! R" y5 L
+ K) c0 F5 F# |function checkform()
o8 s% s E. `; f, q% m% X. }5 n{
- n0 h3 ^* j5 j3 \1 h( L# o id = document.sform1.id.value; 2 j4 m8 P4 Y+ d( i
if (id == "")
3 c( `4 Q9 |8 \' Z v" r {
% `2 y/ R/ x( w0 M; J alert("请输入注册名"); & L& }, V7 p0 a4 _ x6 m
document.sform1.id.focus(); , z S) s9 v4 d$ T' [; s0 ?9 o) |) Q8 \
return false; : A$ ^7 @' u6 W$ _0 L3 Z, r( F
} 1 f7 S+ i5 }8 {' g
+ a3 f* ^% t0 U( l/ y; l6 g9 ]! G( [" z
for (nIndex=0; nIndex<id.length; nIndex++)
: C! J8 K) X1 H8 U7 f0 Z { 7 y+ ], F2 ]+ o7 X( |
cCheck = id.charAt(nIndex); 1 N$ R, ^/ ]6 E8 j1 I
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
9 v+ q9 w& S& C% k7 p! H0 H S {
$ K( N: y% f- g+ [0 Q# _& [ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
/ e" k M4 _: h2 P document.sform1.id.focus(); 4 v, V0 Q! r# V$ l9 Y* e1 h
return false; 2 f, I T) B" W" e* F e
}
" [6 S1 l# `& B4 d, ?9 K( ^+ c }
0 _: `2 W m7 R: r chineseid = document.sform1.chineseid.value; & @$ x5 H5 M" x- s3 C
if (chineseid == "")
+ s$ y( m. ]' Q3 M o& v3 v { % G5 M9 _3 W8 S
alert("请输入中文昵称"); : X2 g" I" ]: R4 k
document.sform1.chineseid.focus();
5 Y. |! j* b) o7 Y7 e. _1 Z return false; 0 ]& H4 W4 D4 O+ Y
} 8 ^% Y2 {& Z0 \' T7 @, o: Q! V1 _
password = document.sform1.password.value;
! m8 A; N. Z! E* C0 n if (password == "") - J) H( R' I9 ?
{
0 z* \: g. A' s& T7 j1 L a alert("请输入登陆密码"); 5 }; V: Z4 W0 f" X- k3 j) x
document.sform1.password.focus();
7 ]" p1 D m2 B1 {9 x, C* Z a9 s return false; * T: Q6 w0 @: `1 Q
}
J: J" U2 y) s I# h8 @ password1 = document.sform1.password1.value;
; V" s: n4 M7 z E, t4 i1 u2 w if (password>password1) W. q9 I( {3 p3 C2 S! M
{
6 u5 J" y0 |) O' {* x0 M alert("重复密码与登陆密码不相同");
" k1 v* G' g8 a- }- k0 y/ C document.sform1.password.focus(); 8 n& J) P& [7 Y( ?- O3 \" ^
document.sform1.password1.focus();
+ x4 V- w' p' w/ \ return false;
1 S8 K$ E3 ]0 d, P }
1 k0 m$ q3 o. @4 D0 iif (password<password1) 0 e2 l) ~. L2 F$ _
{
5 j3 X. ~( Y( e1 w; J alert("重复密码与登陆密码不相同"); $ \7 H1 x5 l& N3 _1 O; i0 m
document.sform1.password.focus(); ! m) \/ }- r0 M, x: K0 r2 o
document.sform1.password1.focus(); 6 G( X9 V, i9 Q/ q
return false;
% y. u& U( z0 m5 J1 G# O; h } : c& U3 G# n% y# s6 K) |, Y
if (document.sform1.email.value == "")
+ Z( R7 H% w4 M4 a, F* I7 A {
) r w4 m l8 ? B alert("请输入您的E-MAIL地址");
% H2 z' _ s' G+ [ document.sform1.email.focus(); % Y0 V+ X4 l8 M1 Z+ \) h) u
return false; 4 T1 m0 V. b( g5 K+ j
}
$ ~5 x9 r) \! r2 `: d" G6 z( X9 R
. r. N. x3 w8 t" ] email=document.sform1.email.value;
/ s7 T0 Z) Y7 a emailerr=0 4 ^% g2 E' K, {8 J
for (i=0; i<email.length; i++)
# M# c& j3 q1 W {
# S( d/ U" H7 C; F+ Y if ((email.charAt(i) == "@") & (email.length > 5))
, m& N1 ~" ]8 |2 x' ` f' c& | { 9 C7 m4 d7 W9 ~' z) u
emailerr=emailerr+1 + \* y( [1 q8 b0 f. T! _! F9 _
} : P1 l; f& q" d: V; j6 p
} - n9 x2 T) v0 n# l0 N
if (emailerr != 1)
$ n) r1 G' e v5 J; z {
. c2 Q$ O8 O l( L: W3 q4 S alert("请输入正确的E-MAIL地址"); . @( U, A+ |- s+ ]7 `* j
document.sform1.email.focus(); , `; d! `) g) T3 u2 i( U1 d
return false; $ T' h' ^: n+ ?8 G4 K- U' B) j
} 0 E& k) `* [# N* S$ W
/ H1 e' P. D1 o/ e9 G+ Q9 J# k1 j
if (document.sform1.checkask.value=="") % q. I. c: R1 {4 _7 Q9 U
{ % M: t" D4 U; `/ [* J
alert("密码提示问题不能为空");
) Z% F$ B+ j. r document.sform1.checkask.focus(); 7 B# `" @: R* @; d
return false;
3 d* S- S; ^/ ?. m- L# a8 g4 k }
8 u2 K; w! g7 Q2 s, }) J( V if (document.sform1.checkans.value=="") 9 H) y6 c& {: e9 j! L
{
! i/ [2 h K, ^; m5 D! S( } alert("您的密码提示问题答案不能为空");
" D7 s1 c5 v$ t1 S document.sform1.checkans.focus(); R" |9 G1 B' b: K
return false; " ?. s# C. H+ X" S* r
}
5 z8 K' w7 a" S$ i2 ` return true; + {8 y$ u5 U1 P p/ b0 |/ v2 P
. b4 K, ^' I; k} # P: Z' J% { M9 S0 o
</script> |
|