|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:+ o; {! m5 ~; V) G3 }
<script language="javascript">
+ B- |1 [+ P5 e; P$ U$ v# ]# S+ [function IsDigit(cCheck) 3 ~" x$ Q/ u. I a8 j/ k
{
. r& P" g: Q8 Y; w: N7 O- ] return (('0'<=cCheck) && (cCheck<='9')); : j8 O. r% W: [/ t3 n, e! [& `
} 3 }& @6 ~6 Y3 a# K. t
) T9 h' d8 M" H# r1 }' R" A% Pfunction IsAlpha(cCheck)
9 R( P- n$ f" e3 ?" y- S, C { ( o' _5 h$ a9 w! |4 I6 r) M+ ? c
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) & @6 ]& m6 s$ k `) t6 V# [
} % `! Q" }6 k" _( i
: K4 {9 R$ U# Y' @
function IsaNull(cCheck)
: }2 M3 n% j) Y) U { % C' @) E9 _* N$ v% Q* v
return(cCheck != " ") O: h# T0 x8 G, ]2 Y( e
}
. N2 p3 m" V( B& T* F, c8 d9 t : R) d+ o1 {! N) d
function checkform()
; D. ?9 `* d) T# @- R# v{ - c) `8 M9 T8 c1 U& G' e
id = document.sform1.id.value;
. V/ U; g; e; q! l; Y if (id == "") 0 P$ @) c+ [* D# l. s( j) N
{
" K% U9 p7 d" N alert("请输入注册名"); ! h7 W& z7 p* U) u F; Z2 `' q
document.sform1.id.focus(); , `' i8 E- E1 n- d8 _4 u- b+ I" g2 V
return false;
- [2 f! [) _9 u f# F9 H }
1 s! g! \( e1 }' f3 T
' l8 l- D$ v' S for (nIndex=0; nIndex<id.length; nIndex++)
- Y& I5 \3 i4 S- N4 L4 H: Z {
; s) z6 f1 D% c; ]; T cCheck = id.charAt(nIndex);
8 }: l& i5 y! r @% g if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
/ c1 L0 [# o2 R7 w4 T {
4 I% J# r( n% v# }9 @ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ) @5 h) t* `& `/ p7 ` }( Q
document.sform1.id.focus(); 6 G$ s, z9 S& [% `8 i
return false; . Y: c% R# K- O" Y: V- F' s2 N
}
. l! P* M5 m. Z* [ } / H1 x% ^" H8 z+ \. i" f
chineseid = document.sform1.chineseid.value;
* E2 ^$ J" b. H. P1 l1 M: N if (chineseid == "")
+ ? Z) v" e; U5 q) y { & P1 c# {8 ^0 H2 a9 r
alert("请输入中文昵称");
- i U: R- [8 q0 k1 }, H document.sform1.chineseid.focus();
& K. a* [4 [* s; O0 U* A% o return false; , V2 D% ~3 w& @' L7 V
} 3 d; D; o3 y) [' f
password = document.sform1.password.value; . M" G- Q: p: z* B$ O
if (password == "") : `4 } s& R% `: b7 H
{
$ b" s D" T$ @4 l5 N- f! t* q6 U alert("请输入登陆密码"); 1 j8 Z. h/ r" G& J. B1 W @, Q
document.sform1.password.focus(); ) A* h7 ] X( T- e, d
return false; 6 V1 ^& I# v3 @
} 0 |( |' i: F" X. H, J, u: q( R
password1 = document.sform1.password1.value;
2 w e! Z9 | J% N if (password>password1) 0 l- T) u( _" n7 [
{
- T3 M) U) M9 P3 l4 v0 _ alert("重复密码与登陆密码不相同");
) l; e: p) r) v document.sform1.password.focus();
. d! d0 D, L$ C% E0 o+ v document.sform1.password1.focus();
0 \' L& d3 A L# d* X return false;
4 s7 M( J% ^: p/ N: g }
( @3 _( t/ N6 L' P& f2 sif (password<password1)
+ a% d. ^# L8 k& D {1 k; x$ s+ _( M2 b8 [- E& y- J7 P
alert("重复密码与登陆密码不相同"); 1 ?( x. T9 P6 f8 l5 N
document.sform1.password.focus();
; D' B/ w3 |% ]& h/ r% ~ document.sform1.password1.focus(); + f! A% ~) K; {
return false;* i# j( m4 ?6 u: o) R
} 7 ?& A- u/ Y5 i9 h
if (document.sform1.email.value == "")
- S& M9 p! r4 k {
8 _0 K( k* g. j2 U- J; X6 X+ m alert("请输入您的E-MAIL地址"); Q! B L$ a* E. M/ B
document.sform1.email.focus(); 1 Y) x+ I* { H2 n8 \! D* T
return false; ( T- k5 U" C+ F8 h, A( M# i8 z
}
" |/ S/ C5 d$ G2 V5 Q7 Z 1 E/ Z5 U* p2 C6 @
email=document.sform1.email.value;
" C7 I4 i; t |7 y) i! @& r emailerr=0 0 z$ b# K. a2 @ x
for (i=0; i<email.length; i++)
* u$ i& [2 F3 k { % \1 x* z2 g- A9 Z0 f7 s
if ((email.charAt(i) == "@") & (email.length > 5)) : C5 A3 U. B7 T, u" F+ O1 L' P" M
{ / x8 y) P4 K( [3 s
emailerr=emailerr+1
9 y4 X( G' W0 Y } 0 J/ y; J5 t: i5 W" V0 C! z8 M4 i* {
}
' V7 ^+ o- v$ _6 r+ X# U' w( \ if (emailerr != 1) 2 D( v- V0 P Q
{ . d; U! Y3 o- G" C: p4 S2 K* T
alert("请输入正确的E-MAIL地址");
' j3 i+ R! B; U: Z9 { document.sform1.email.focus(); 7 F& R8 p# O! ] e+ P" P8 w6 b
return false; * u- m2 m1 N( I0 Q p
}
5 |# ~$ N/ z. R2 E . {9 u# b4 I% O- o8 h6 w
if (document.sform1.checkask.value=="")
( W% b* S, c4 q( j' R1 B* S7 p { 3 n% k$ W9 y, {9 ? h5 B
alert("密码提示问题不能为空"); 7 d3 g: i7 n( H3 S
document.sform1.checkask.focus();
9 H' O- l; \& t1 A D! k return false; ' P4 }& a" `+ Z) m2 c( [2 X: P
} / z! V$ N* r" G6 }
if (document.sform1.checkans.value=="")
" w' t8 z) t0 W! q9 r2 }9 w {
4 W7 u0 v2 F. |1 A" n) B# Z alert("您的密码提示问题答案不能为空"); ' N. O2 K) O C4 r6 P7 l
document.sform1.checkans.focus(); ' J( E8 M7 e7 @ y; u) i7 K- Y
return false;
6 A. u/ g. @* x1 T: i, [( P! a4 s0 N }4 h, b+ f2 y4 _- l9 x
return true; . e6 g, v3 c( u- ?
, V0 i5 U( v S6 ?) \}
) F( c% n( y% D! {8 c</script> |
|