|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:
( R; x0 {1 n+ X9 a<script language="javascript">
, v# l- q F6 U2 Ofunction IsDigit(cCheck) ! t# \; ?( t' }: W2 P
{
2 K7 ?: E s; X/ Y) I( E+ z4 P return (('0'<=cCheck) && (cCheck<='9')); 9 i3 m7 Q3 C. D$ X
} ) p% o/ x4 E' [* r( a$ ?
0 a9 w2 c3 y; l! d3 P5 h. Mfunction IsAlpha(cCheck)
" @. T1 L; U- j1 |* T6 _ {
/ |2 Z% X& [+ a# j! o1 q ? return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) / A/ b- X( }/ G% f2 `# w B
} 9 j' G+ N; \* ?2 ^8 \1 q2 ~
8 G3 o# I$ V6 \- r) \function IsaNull(cCheck)
- `6 x3 U# p) t; |* N. F( W1 P* K {
) Y" _; w' a6 J% ~$ t return(cCheck != " ")
4 P H0 E/ t2 l% h. R }
& K% C' N7 Z+ U& ^; U1 Q3 y
! n& p! \* P, ~8 Rfunction checkform() 9 D* y: L3 r7 k: A2 D3 x
{ 0 C# R' g' S& |% P: N1 q; a U& O
id = document.sform1.id.value;
s! M- D/ p6 M z) E8 K if (id == "")
/ A# W/ R$ M3 V5 X7 A { . ~1 {4 y% b( x. d( s; ]" S
alert("请输入注册名"); * O5 H) g3 ^1 N4 q8 A
document.sform1.id.focus();
( u& I6 ~9 l) m return false;
, C! d8 o- ^9 N) Z } 8 F! U9 X- A1 q9 w4 J/ P
0 j! t* Z# T6 N- K) z6 S" a& R for (nIndex=0; nIndex<id.length; nIndex++) ' `, r! _0 g1 Z/ L( m9 C" |$ g
{
! d# |7 a, n/ {1 A cCheck = id.charAt(nIndex); / L2 f% m: a: X" `
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
2 m8 u" s; X& O {
- k |& |$ N, L) V8 ^ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
# ~1 }6 C$ o4 r7 d document.sform1.id.focus();
/ E \' t* r( i( Z& S0 v5 r$ w! `. o4 Y return false; 7 N: Y* C8 ~1 i0 R. ~3 ^" S
} * s0 V u% w3 j# X* y8 l3 r
} 8 g5 F* d+ ], T( {! |
chineseid = document.sform1.chineseid.value; 7 x8 [8 y6 a$ }- H5 w
if (chineseid == "") 3 V* k4 I3 Q% }+ A$ d& i
{
/ E/ W: |6 O b6 |) P% {2 m1 Z" Q alert("请输入中文昵称"); 6 x9 b* g- Z, {1 M. h1 K/ X t
document.sform1.chineseid.focus();
9 q" f6 B. M2 c9 @% p1 q) t return false; 0 t% i* O" P& c
} * X `! ^0 \7 H [ y R8 m2 P
password = document.sform1.password.value;
3 K% L0 \; R3 ?- u; q$ N if (password == "") " J1 A! V8 u6 ]1 ~
{
2 N4 L( L8 M3 X1 j5 d0 t9 ^. Y alert("请输入登陆密码"); , J0 _' J4 m4 J, ]: P+ d6 j/ ]
document.sform1.password.focus();
5 n# h/ E; Q% H7 O! g, l' V5 @ return false;
2 y7 h u/ E& o6 F }
7 r0 w+ b- V0 [: ?1 J: X) T8 S password1 = document.sform1.password1.value;
. P# j: L* v" S$ D+ \' G/ J) Z if (password>password1) 9 ?* ^. w. X8 u, m! G2 [) I
{
+ {6 |. f0 }- n, l( k/ r1 d5 } alert("重复密码与登陆密码不相同");
7 e+ m. ]/ Y+ X; {" w7 U0 @- s7 i document.sform1.password.focus(); 5 ~5 t. S& L- {; _
document.sform1.password1.focus(); ; b- q. U) n$ r: ?6 F$ G/ p
return false;
' O5 v) h j( q; q% s/ z* U/ P% R } & `/ o# P5 b( M+ X- o
if (password<password1)
- P/ P5 N1 W3 @+ H: I3 W# e: } {
; \- k* _4 v6 X$ ~. A8 c& J* W alert("重复密码与登陆密码不相同");
$ G }" p$ A& ?' @. [ document.sform1.password.focus(); ( i$ e* U j6 g$ ~4 @& O
document.sform1.password1.focus(); # h2 h* c! @6 |: P
return false;
) y: }) u3 L9 B( h% v( u, @+ F Y } 8 Y6 a0 |: d4 o7 U! ^
if (document.sform1.email.value == "") E, h2 E; x! x- z2 m9 x) v
{ 2 x" I$ C, ?& v( \
alert("请输入您的E-MAIL地址");
- [7 S% D [4 T$ I W. c. x+ y$ @ document.sform1.email.focus(); 2 U+ t7 s% Y9 J$ I& z
return false; * `# e2 I( w' F. j% s
}
% R' Z! y! c6 ]" H$ j# V / A, W# U' Z3 h0 `8 W
email=document.sform1.email.value; - H2 V3 w. _+ A, Y
emailerr=0 . H- R, X* Y, x5 z2 Q% t4 _9 V
for (i=0; i<email.length; i++)
, ?- N8 P/ U, M. W6 G% N { ( N1 S0 t- Q. ]4 e/ x! |
if ((email.charAt(i) == "@") & (email.length > 5))
* x# f7 q; l/ b' Y( o/ k$ M% I# S; l { 8 Z3 R& n; f5 O2 h/ W8 [
emailerr=emailerr+1
2 S8 W8 R, ^1 y2 Z4 D8 m }
; ^% J. G+ u5 P! ]- K y) v }
, c& H; E$ x. |- B! e& U* W if (emailerr != 1) $ g0 K7 T8 m x
{ / `4 ?- L; M9 n* j9 w3 T) I( c* o
alert("请输入正确的E-MAIL地址"); # o' ]# }0 c8 V* h' h: t
document.sform1.email.focus(); ! V/ w7 l! n' \& v& X/ \
return false;
9 U$ A4 ~9 t9 K } , {# `+ V* a. K
9 A! a9 j" Q( Z; ^+ e if (document.sform1.checkask.value=="")
7 m. Z2 }% K8 ?, ], S: q$ m {
/ I, H5 Y% a$ m9 F alert("密码提示问题不能为空"); . j# B% j6 |. B% E0 K; q4 K
document.sform1.checkask.focus(); 5 b; l4 z3 D- O7 j9 ]# ]/ Q5 K
return false;
/ V3 |0 D) ?, Q8 Z* K7 m }
; [; t3 T! U1 A6 [ if (document.sform1.checkans.value=="")
) U; |& ]# b9 W$ Z/ h5 { {
) B- c: p; [ J- }$ b, b alert("您的密码提示问题答案不能为空");
: y4 L2 R, d, e& T document.sform1.checkans.focus();
+ M1 T: M3 ~7 L( \2 [ return false;
9 Z# Y3 n' i8 P& c ?6 Y }" B1 A7 ?1 u6 }4 h
return true; - ~2 z# T2 @9 a' }( Q$ i b
/ [2 r# A" v2 @8 @8 ]/ j
}
* j; @" e) Z2 `9 R* a</script> |
|