  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
这个脚本对你可能有帮助:4 k9 T; `- l Q6 u/ A, v
<script language="javascript"> 1 B: z) Z X$ t( |9 l
function IsDigit(cCheck)
6 w1 {2 V! K- X) `7 R+ V2 U {
- j, b! d H6 l' @! C: y return (('0'<=cCheck) && (cCheck<='9'));
2 s4 W# \ e2 S9 j3 @2 T2 i }
- v' k r6 i' i3 D& p
" ~5 W% `2 ]7 o5 afunction IsAlpha(cCheck) ! J& A- |2 _& j# ?
{
5 B8 K0 W0 V2 V# _" n1 u1 m return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) : H" l! X1 l% Z# U% Q1 C/ a* u
}
5 W2 h' R: Q- w/ {( M, g, T, i' e
/ h) q6 X, x5 W' z, b1 X; Ifunction IsaNull(cCheck)
0 ^- t8 @* B% N* h { b& G( e* Z4 ^4 | z& A( W
return(cCheck != " ") M1 j3 u: O/ Q/ m- T) k5 Y
} . @/ \ T" b! H% V* p$ w- X
3 C+ p$ J. M1 o& K- H5 ?- ?# \. E- ?
function checkform()
# Q: F. N. q/ K: q0 ^{ 8 E6 G0 ]6 _+ F0 q: N
id = document.sform1.id.value;
3 j4 x; O& [8 t; x# ~" V if (id == "") - X) z. d4 a K. C
{
/ h' ~! A; y: |6 [9 X4 G: i alert("请输入注册名"); 2 n2 H" Z# ]6 S* @6 O4 l0 R @
document.sform1.id.focus(); $ Z7 k1 m6 U5 V0 R( d5 R# R
return false; / ]2 R% k6 M, ] r+ l9 N: d
}
+ u: m. K1 q% {
( V; S: N5 W( F: i5 m e for (nIndex=0; nIndex<id.length; nIndex++) ! S# h7 ]7 a% b" \
{ : k5 d1 ], x1 W7 U8 F' X* d1 L
cCheck = id.charAt(nIndex);
# `* \5 q2 N$ l if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) * A, k7 [& q9 ?5 H% b: u
{ 0 v3 p8 e7 J% O r9 Q# j, b! {4 s
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
6 D+ p; S9 E& h f% H& M) s9 F+ T* g document.sform1.id.focus();
0 M+ n B* E2 D( ?7 p$ K; ~& V return false; # g$ @+ T1 h8 Z% B0 C
} / o- {) n+ B# b; h& M1 q- X
}
$ `& x: J8 G0 Z0 B1 g" w9 M: p$ z chineseid = document.sform1.chineseid.value;
( p2 L! s8 t4 I9 a; a if (chineseid == "")
* e1 K4 d% R5 x x {
6 \1 n/ ?5 E0 h alert("请输入中文昵称"); ! M; z' ]: Y4 i6 _" k8 {. D# y7 L
document.sform1.chineseid.focus(); * D1 F/ l( I) h3 \5 i a. M1 r2 I
return false;
7 b* H: E0 _ C! c( k; \0 a }
9 p$ i( V2 R' X) j d) N password = document.sform1.password.value; , Q+ J( F" c+ v2 C$ g
if (password == "")
- x3 ?' g0 ]" V# X# g) v# X6 l {
! J0 a# [( \* \. h4 _; Z% L alert("请输入登陆密码");
z' I6 E" r% B0 F( l1 X document.sform1.password.focus(); E8 a7 ~2 u0 b& W' H" q3 ]
return false;
: H( `0 `8 o+ g0 d- R& q }
* w- L. s- }5 B7 V password1 = document.sform1.password1.value;
0 F& e# t# b: M; T: G1 |4 p; J& ~ if (password>password1) 2 C; p. r/ A' W U* w8 p
{( v2 U0 j4 }$ P
alert("重复密码与登陆密码不相同");
; c. p% b4 O) u document.sform1.password.focus();
' s( O( v" \& _3 M document.sform1.password1.focus();
% z% F' m0 H! l, ]7 m0 c return false;. N% p4 m2 W1 `: E' ~2 l
} 2 \, g$ x2 ?. U8 A9 J1 T
if (password<password1) ' w5 S1 ~' x- _8 M$ _
{
+ p/ A4 {/ K9 J- B8 E* M k4 V alert("重复密码与登陆密码不相同");
3 d" l5 t. O. ~7 j( x$ c/ k' ?$ _0 } document.sform1.password.focus();
$ G+ }4 X$ B/ y4 h document.sform1.password1.focus();
7 }0 N1 k* v8 ^$ O2 D return false;
$ Z/ p) [ g: T% W4 `7 B }
/ z# P2 \' r4 O; S' B if (document.sform1.email.value == "") $ S& `4 J& t6 k* N
{ ! @6 E6 s& s. P' I; x1 Y
alert("请输入您的E-MAIL地址"); ; ^2 m' f B, c% R
document.sform1.email.focus();
$ x$ }) A$ p1 y, Q5 I9 e return false;
% B" ?# @) k- c }
% S5 t) w! _ o; ~, f$ \/ [! \. V
$ X0 G* D+ g; I: ^3 f: ~7 r+ _ email=document.sform1.email.value; ' ]' |# n/ g( |( _7 ?3 S! {
emailerr=0 ?6 H7 i% N X2 c j
for (i=0; i<email.length; i++)
; R$ u/ }6 j: P- h {
* [8 |$ n i7 c* f: o5 s if ((email.charAt(i) == "@") & (email.length > 5))
1 q# r. |# ^! n5 y4 x { ; b! Q" T/ g5 W
emailerr=emailerr+1
: j6 X) A. U5 n# [# `4 A } " U$ o( K- S: D2 x) m# P
} , d5 ?6 t% J- B: `
if (emailerr != 1) 7 H, b: T& _$ s$ ]3 y
{ : U* p% m! v# x! \( w; r
alert("请输入正确的E-MAIL地址"); ( d% ?3 Y6 F: x+ } }" g3 i
document.sform1.email.focus(); " A& @' |7 Z/ e( j/ `' J
return false;
, ]$ q" S' A1 K& l }
$ ^* p$ J- l. O6 q% G . r6 b. m, {' ~! v! p& X
if (document.sform1.checkask.value=="") ) o2 K5 _0 I: d1 w# b# I7 u' N# \1 t
{ 8 a, I8 |3 [, P$ D/ `% M' ^
alert("密码提示问题不能为空"); + j V6 P7 Q4 g& |+ A B
document.sform1.checkask.focus();
4 ]% D# ^8 z4 M$ R( v* t& K return false; ( A8 ~3 X' n& V5 V
} $ d8 V3 }5 j5 B& V
if (document.sform1.checkans.value=="") 5 B0 ` x5 t! ~7 x
{ 0 i2 Y5 r; z" i5 x9 r1 H$ n
alert("您的密码提示问题答案不能为空");
/ a- T- H8 h8 ~5 U document.sform1.checkans.focus(); D& F1 Q9 a2 i) z) m0 `6 U- `# E% }
return false; 7 t% e7 Q% J2 O4 Z4 v6 C( l
}
0 N& v; s1 s2 a8 f' g4 P3 @ return true;
( s9 X% ]( H4 V
. y& d; S. z. K+ B, w( P( D}
J# ?( T9 V$ B$ s</script> |
|