|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:
* W _( t1 \" X# t+ q<script language="javascript"> - Q& R, N0 W% f( C$ W
function IsDigit(cCheck) ; e! j" K& Y& s. r5 d/ P
{
' p8 o4 i" |! }% h return (('0'<=cCheck) && (cCheck<='9')); 1 }7 Z; W$ m$ y5 Z3 C
}
$ x7 e( }8 W6 b- H! U
3 W, A/ R: [7 |function IsAlpha(cCheck)
8 c/ @' G8 d- j6 Q+ q t { . v3 A0 S' ]# _+ [$ m) `1 L' ~
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 k' b/ L( ]& F9 b3 Y: }+ W
} ' K8 |( C% M9 _( K5 Q: \' e2 R
( T5 k* o. I0 A1 E( ^# l$ R2 H
function IsaNull(cCheck)
( Y# z' d6 q" i& d5 j {
, @! K: P5 ?( r; H+ h( C$ W9 q6 `& k return(cCheck != " ") ) n% L; ~7 l9 H6 {
} . t# f% a3 R& J2 l( ^
- o9 }3 i* _5 B. i3 [7 a, Q3 Gfunction checkform()
2 }/ V8 v2 Y; C; q" y{ 1 [0 v6 C g) f$ N4 w# z9 i
id = document.sform1.id.value;
$ ]$ M2 G, v) f$ \& H4 D if (id == "")
4 n$ c9 W2 k: j1 ~ {
) I- Y' P* x6 y6 i( M alert("请输入注册名"); 0 F0 S( I4 u/ ~5 j
document.sform1.id.focus(); 2 x0 B* L* ^$ a1 j2 ?! i+ Y; n
return false;
% i5 r# _5 ]2 q: p }
. P) H# \ P# H. H. e% G 7 n4 I8 F+ i! Y# {, `* _
for (nIndex=0; nIndex<id.length; nIndex++) 1 ^/ r/ ]9 u- ?3 F& f' a! l
{ - `* f# Z1 w9 H* B
cCheck = id.charAt(nIndex); 7 R5 c7 T" x1 g, f. R: ~
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) : i" Q/ U2 a. f9 E
{
4 Q! \8 {& D7 Q alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
9 c- s. V/ i* { document.sform1.id.focus();
5 v& _! C# P" F/ P5 M4 u7 J6 v return false;
; X* T6 s* G9 A+ M0 U }
6 f# J7 b% P9 X" T/ o& Y! H' I }
, Z1 n1 ]! M% C0 D6 M, G chineseid = document.sform1.chineseid.value;
7 R" o" H8 @9 D% O* E if (chineseid == "") 7 \& C" [4 ?; n" |1 ]' G4 O9 J
{ 6 o+ d" g4 H& V! k# q) Y) i0 H
alert("请输入中文昵称"); ' Y" a* j" V. P- O
document.sform1.chineseid.focus(); 7 d# G9 T, [$ L
return false;
4 ^9 j4 i/ Q" F# L$ E( f }
. {& E5 L) j; p0 c$ h. w password = document.sform1.password.value; + Y7 l% X2 k3 }7 k. s+ Z/ e
if (password == "")
+ ]# v N0 n" O. |- S( p3 Z& L5 x { " g# @8 T. r1 e! A) m; {3 f
alert("请输入登陆密码"); ' k+ F0 C" y" I" h
document.sform1.password.focus();
! C9 a* y0 p1 g9 n; w return false;
, |$ F2 X) G) ^4 p } * f% I- w5 D& W3 [2 f% m# I' }( d" Y
password1 = document.sform1.password1.value;
; a" g( p3 g% E* u6 ?' }2 z J if (password>password1)
8 D6 x+ S! k; `7 [% r8 L {% ]8 ?! j* m# L$ k8 C4 i
alert("重复密码与登陆密码不相同");
4 e# I! p# j; f6 o8 c document.sform1.password.focus();
0 r' w1 }! I8 H7 f9 f& a& v document.sform1.password1.focus();
1 S/ M$ i) J9 ^* S$ m* }7 q return false;
8 q4 f* y1 x# k o/ y) c } & _9 w- c0 \5 \3 `2 W4 y3 R, C& ~
if (password<password1)
6 t. s( x/ w& | {
2 R: f @9 e4 |0 f; e0 L: c" H4 S alert("重复密码与登陆密码不相同"); - f9 z4 G0 ^; q9 N @
document.sform1.password.focus();
; s* Q2 T8 |3 ~: K9 y document.sform1.password1.focus();
2 E, q( F0 v. l2 M return false;9 K- S* q1 ]9 r6 }# @
} / W6 z7 Z J0 a7 N% k6 r; v
if (document.sform1.email.value == "") ! V: N! r& h0 A) y9 E
{ / ]" K& y" ^, t7 s/ L
alert("请输入您的E-MAIL地址"); ; u7 G' \: x2 P# H9 ?4 q5 v
document.sform1.email.focus(); - g n' {+ N0 G& P' \% ?
return false;
a- ]5 t) V- S+ {, o }
F0 O n. Q1 Y* Z: Z# L
' P( V W% Q5 r$ }: h email=document.sform1.email.value; . U* \6 B2 R+ k# n+ I8 Q u3 @/ x
emailerr=0 * n4 ^, E/ S( }" z* _
for (i=0; i<email.length; i++)
q& X. X. _! r { ' z6 c/ B) g" N5 l O: I
if ((email.charAt(i) == "@") & (email.length > 5))
6 O, A- d& B+ o3 @8 p {
* O% M1 \4 s: n, i emailerr=emailerr+1 ' m6 w t" M) h$ L8 R6 j
}
" e3 z) ?( f% `3 V% _/ m# P }
1 P: F6 M* w7 b; U if (emailerr != 1)
3 V8 U! W- @' b4 X" @# C6 R {
- U% [! v) Z/ C( X; c alert("请输入正确的E-MAIL地址");
; X4 R: K+ B) G! @- V document.sform1.email.focus();
9 S' ]. r- o: I* [ return false; . K0 q1 E5 \$ H6 B B7 [
}
* b) M3 ^0 Q7 _2 ?3 I4 y3 Q/ i" y
6 a0 A$ B# ~ @8 b( S" q) a7 p4 y if (document.sform1.checkask.value=="")
3 {4 U3 s3 n: I6 Q { 0 |- e8 r4 @% J' [" H
alert("密码提示问题不能为空"); % ?8 c- u) G3 F S
document.sform1.checkask.focus(); : b- q) l0 U9 j, F1 a5 N
return false; % w, n% r# }1 L, w9 ^; |2 L* `1 c) l
} ! I( Q$ Z$ _ {7 [* Y; e; S4 x
if (document.sform1.checkans.value=="")
8 j' Y" f7 z* c% [, T {
+ @1 P. O6 M; ^' e8 B3 ~ alert("您的密码提示问题答案不能为空"); ' T" V4 d- ?# N/ l) t
document.sform1.checkans.focus();
8 l/ C* D _% r return false;
. o: s& Y1 Y u4 p. N: v) ` }
- f( S& k1 ~% a8 `6 f1 G+ U: G) h return true; $ f0 C0 P3 A, b, t
+ J! |) Z) {7 p* m. L, r}
0 e8 w6 J% a7 I! f</script> |
|