|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
! a; K' s$ C. f) c<script language="javascript">
1 g$ @/ ?' r4 r+ V/ z, C7 ~5 L3 gfunction IsDigit(cCheck) ( T! V: \% o* q6 \% K) l, V) p
{ # D# N2 x0 H+ K3 T0 L J5 a9 j
return (('0'<=cCheck) && (cCheck<='9')); ; g2 d4 b3 @( N7 k
} 9 C6 [) R7 c- z- \+ Z3 t" |
. o: c) H0 ]4 f! d" b
function IsAlpha(cCheck) " F# `5 a! T* L7 |: n& f3 T ~
{
& u) R: E$ W; G return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) - T! a) B1 Z* l& O. r7 x
}
7 b7 u: `9 n, Q ; L q7 b/ R- x9 r
function IsaNull(cCheck)
' L% Z- ~4 n# p- V7 |0 D { ! ]% y$ V& k3 v- @1 O
return(cCheck != " ")
& n* U# ?2 k V3 P6 P } 0 w* l e9 c) Q } V' x8 [
" U( n' M6 {. U# G+ A1 Z* h" z
function checkform()
9 i2 {/ v* p; @* e- i* H{
! p! g; @9 l# _% J/ f; ]' Z1 A/ T5 t id = document.sform1.id.value;
' G$ S/ _" ~6 t/ O, n. f if (id == "")
. u" [# k, Z" m2 Q5 S' Y4 S- P {
! A. h) h8 a1 \, `8 M5 U. W. Y alert("请输入注册名"); / l4 Y/ g- ^+ M& u* O* M0 j
document.sform1.id.focus();
0 J1 C" A- ^/ J; @+ a- o return false;
, ~, B# ?3 X* h C$ M6 w/ m$ _ } 4 q3 }) h1 h: c: g6 D q5 s, ~
6 N" o7 W1 V0 G9 u) k2 l
for (nIndex=0; nIndex<id.length; nIndex++) 3 J8 E$ _# ~4 z. G* H4 F
{
$ e( r( ]& e8 N( J f cCheck = id.charAt(nIndex); ' J3 v7 j$ h) r8 c/ M3 e7 S- B& x
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 0 s. x" \) g3 J# c# B
{ ]( t( }, o0 k4 e
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
( t" X, U- g; [+ I$ e5 x document.sform1.id.focus(); % C' w$ E9 m: T8 ^
return false;
$ D6 d+ |* b5 s8 M1 W) y( a }
0 c& ?' e2 `2 C- e# A8 p: h/ @ }
; k+ B7 N7 b$ M& [, Z/ Y7 X chineseid = document.sform1.chineseid.value;
5 S6 o" `: ^5 M) T _+ m6 x6 p% Z7 \2 s if (chineseid == "")
$ J7 O6 [1 \, A8 D( b( z { 5 U. l2 m6 F" i% [( Z- S( w
alert("请输入中文昵称");
+ A. ~, X2 P4 u% X9 R document.sform1.chineseid.focus(); 4 ~9 j& ~* L0 G$ [# |: |
return false;
, r, D' r4 ?, p) | r r }
9 G4 H- u+ m9 K password = document.sform1.password.value;
% D5 J( ]/ U5 k2 p* L8 p if (password == "")
5 s# l; K$ ?! H% t t {
n1 W1 x2 r% D: ?: R( m! a alert("请输入登陆密码"); ; s- h4 I' B S/ }2 T* a# e
document.sform1.password.focus();
" W% r; T) `2 _- Z return false;
9 p' T, P& n( \ N4 B4 h }
) f) e& m/ u( j5 x password1 = document.sform1.password1.value;
, Q- N% w, q, C$ F) J if (password>password1)
! ?* j; s9 b: F3 J2 L/ C {
( [) X* L# }0 k' ^: T alert("重复密码与登陆密码不相同");
K ^6 T) p0 q) H* o: A% x W document.sform1.password.focus();
`/ U2 m4 i# j @5 x. g document.sform1.password1.focus();
$ b9 R6 W: D5 ~2 V6 f, A) Z return false;
' @ c/ U2 |$ v" T }
4 q7 [$ e7 e6 xif (password<password1) / |% o9 d$ I6 N$ r c
{0 ]* f/ k) C% c/ e: V, N) X8 n
alert("重复密码与登陆密码不相同");
' p5 e; j2 P% J P q1 ?" ^! v# I document.sform1.password.focus(); 6 V8 q8 l3 G- L6 \/ ?" C3 E! ]/ t
document.sform1.password1.focus();
' ]5 I7 X+ v L: U! a1 m3 p return false;" y& Q& i6 p3 q9 c
} / ~9 Q4 F: u1 d; X7 l- ^, ]
if (document.sform1.email.value == "")
- o/ z" y" y, Z( w$ B: I: b {
; t: C' V. U* o: A( A8 I9 ^" p) | alert("请输入您的E-MAIL地址"); 4 e( ], s) u8 s# G3 }
document.sform1.email.focus(); * {1 _* e1 g+ L
return false; . G1 v/ ^5 p& A
} . Q# X4 H) _( I. j5 t$ ]9 q- n" n
) w0 _9 V4 ?1 g% H& c email=document.sform1.email.value;
: W- w# e5 k3 Z6 { emailerr=0
1 `; t; L/ C: b7 ^8 I% O for (i=0; i<email.length; i++) l2 ~! f/ S0 K1 _6 x7 U# _
{
+ A+ R3 p+ r" e3 y if ((email.charAt(i) == "@") & (email.length > 5)) " g9 c) N- n# _8 o9 j* F8 M% D
{
( ]6 A; m) B3 }4 Q2 j. Z& K8 N c emailerr=emailerr+1 3 b2 g5 U8 p9 G: D( T* |0 e
}
( S w. o+ b0 K7 ^3 s) ?( [ } 5 r; ~" G& [8 i$ w8 s& s) O/ b# p: k, k
if (emailerr != 1)
6 o! Z' G/ J B { ! _' t' {& b9 I( i4 o" r; a
alert("请输入正确的E-MAIL地址"); ( @$ ~% a* B% ?
document.sform1.email.focus();
& T2 j" g* l/ o. z' r return false;
$ n; U' ^3 A4 f1 z! }$ B }
' X$ c" o+ X6 e
) Z1 r+ g2 p& R% T1 O6 `. K3 Q4 B if (document.sform1.checkask.value=="") / Z: M7 e6 Q8 |* a
{ ) B' F2 Z0 A% s' d, I9 a
alert("密码提示问题不能为空"); 0 r) {5 b) U. z, V" x7 ^6 \
document.sform1.checkask.focus();
; F3 O& n& j& ?3 h return false; + W1 y0 h& Z' b" | ?+ N1 Q
} ( x* H! v% Q* E P
if (document.sform1.checkans.value=="") ; e( { V& y# [& O5 `
{
" a( o( B+ G; J1 i* r alert("您的密码提示问题答案不能为空");
/ t1 n3 f! I0 b6 y6 H* J' O6 h document.sform1.checkans.focus(); / h5 n. [5 h9 [% z8 d
return false; ; K! K5 k6 C9 }+ _! R
} K$ f7 Y0 n) F H2 \# E6 m- W
return true; + X& h) o( d% c; C
9 G4 G+ ]# c8 T+ f2 H9 Y} ( d R$ U: a4 p$ u: p
</script> |
|