|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助:0 O) c7 W3 p, u! g
<script language="javascript"> 1 q: M* f; [ d0 t. _% v
function IsDigit(cCheck) 3 w! @4 v: V1 z2 F3 d9 ~, D" V
{ . k: ~$ V0 G' s' m+ @: u- V7 V
return (('0'<=cCheck) && (cCheck<='9'));
* ^2 F. r6 F# A% ^ }
2 Q& \; S$ \3 X7 q; k5 B7 }8 I1 S4 F
( R6 }) H- b& V) A3 A7 Kfunction IsAlpha(cCheck)
+ t* y h% Y3 g { + i! @0 ]6 f( V# Y1 \1 X8 r
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) & p+ P. j+ d2 Q+ ~: O/ g8 t% {5 v
}
0 {% w u9 Y5 B9 b* U u4 e
3 J: ?( E% v# S& C+ l6 Y0 X: w& [function IsaNull(cCheck) 2 d' [8 p+ O' a- G3 C, L
{ 1 I. p$ g+ r7 o( h8 \
return(cCheck != " ")
- H; }# j* }' `' O; [' j } 9 S% t* B% U k5 C: {' V/ g% L: H
: U- _: g8 [' V$ L/ C5 X
function checkform() / Q0 M+ M, v3 v. Z6 X( A
{
3 l3 r3 m* B+ @. T8 | id = document.sform1.id.value; 5 D, H$ r$ D7 b' m! |
if (id == "") / A. |' T( q* U+ e
{
! j) W) ]* x- k/ b7 a9 \5 G7 d/ S alert("请输入注册名");
' F; |- F: j. Z' l1 H document.sform1.id.focus(); 6 w8 r! Z! s! F0 `2 W: Y: ^
return false;
1 V( b- u2 [8 F% d" r* A* d& i } $ y0 m" P1 h/ x+ Q+ u
. x) ]2 t7 k2 O) B
for (nIndex=0; nIndex<id.length; nIndex++) " [# |+ e+ Z: J6 c- P$ v0 T
{ 3 ?+ ?6 w, \4 j7 M/ L5 U7 Y. `
cCheck = id.charAt(nIndex); 6 o% {1 F/ L/ A; b! g
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
( c) c) y9 z( _ {
; m" e) {4 u. `2 \ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
/ A" f# s' d1 e" r% M document.sform1.id.focus(); 8 U% P5 Q5 o; x6 g [: g: t
return false; ' E3 \4 w3 \0 N% a, Y4 F# ^) r' |
}
% s8 ?* D5 j( w# c0 R0 Q" X" d } 8 n, O4 n7 D0 i. X, p
chineseid = document.sform1.chineseid.value; ' ?/ ^3 X8 n( @/ m! r, `
if (chineseid == "")
C( e6 ^; N3 T: B( @2 S { 5 N6 z+ h+ j' P4 u @1 ^
alert("请输入中文昵称");
) g/ _" E# x2 n7 B document.sform1.chineseid.focus(); " `: ? U$ A, H
return false; , W3 b. A7 [& I0 U1 g D; \( Y
}
" ]+ \6 r9 f2 E: O+ S password = document.sform1.password.value; " e/ i; N% b) A5 j" A! z3 V8 p
if (password == "") 8 G$ H' S% U/ S% V$ U0 P
{ ( k2 x* n5 x& e8 y/ K; y' q
alert("请输入登陆密码"); + R! t, _9 E' A* m; u* F- I7 D
document.sform1.password.focus(); , w8 A# B( R8 n
return false;
8 @3 |. [2 g7 a9 }* }$ U } # O" }7 x0 b) @' M
password1 = document.sform1.password1.value;
# W5 s$ Z' L2 B. _& w3 Z( t if (password>password1)
* V# i3 W# j- t {# F, V6 Y: f, n0 F3 N, k& u5 |; ^: L
alert("重复密码与登陆密码不相同");
3 v0 U% ?. v: ^. m document.sform1.password.focus();
; ]3 O5 t. E E j" [ document.sform1.password1.focus(); , `# ?1 ]+ _- E# K5 B3 Z
return false;3 r, ]% i" P0 U8 N* J1 a& y
}
3 _! ]" D* b o' h, R) B! u$ dif (password<password1)
1 s1 r" c8 P* D N$ F {& G; t+ M, t6 ~3 J
alert("重复密码与登陆密码不相同"); " w" l3 S" x# R* q4 h" O
document.sform1.password.focus(); " A: T, Y( u" r s# B0 \
document.sform1.password1.focus();
6 p' b6 H ]; k return false;2 T D8 d& B- i, ^; s
} % r3 t9 N6 r3 w& o# }
if (document.sform1.email.value == "") : @# G) V# _$ S, E7 ^
{
5 r7 P: a8 R' G5 `0 j4 R- ] alert("请输入您的E-MAIL地址");
: Q" {& n! P% b+ R, f document.sform1.email.focus();
$ Z; o# T& o' G5 {3 H8 |- c. g: I. ] return false;
4 h$ g% b x1 L }
8 ~. R0 z( H) q7 {4 _
* P, D5 w% Y6 a. y email=document.sform1.email.value;
0 N* V! a4 W& I. H) r, l) h- x emailerr=0 1 H$ n. T: j1 z. d2 G" R
for (i=0; i<email.length; i++) Q& r! ^8 X% c
{ 8 r3 i0 o3 ~$ O! w: J
if ((email.charAt(i) == "@") & (email.length > 5)) ) d) X5 e: V# a, v
{ N* _3 }( H) ]- C3 Q; B1 ^
emailerr=emailerr+1
8 G7 _/ z' n+ |. R! p1 u( e- d) k- i) n }
" q5 r# j" f, g$ B2 P( z1 P. ] } 5 o" f7 q! t- |0 H
if (emailerr != 1) " W$ [1 ?. F" Q# F; m+ p' r
{ : W$ ~ t' [! Q, Q. a" S
alert("请输入正确的E-MAIL地址");
" \2 q$ x% S) m0 ^1 B document.sform1.email.focus();
6 t! s9 |6 q8 A% k! a8 Y return false;
. F* A$ ~+ J, H" P }
J8 _2 {9 B# O. a; E
% e8 |: i$ s P4 l5 j; U3 a if (document.sform1.checkask.value=="")
1 i4 v1 F2 ^- O' Z* k: V2 v { 6 d9 S( _4 g5 p9 D$ ?; S/ K2 _5 t
alert("密码提示问题不能为空");
, ]$ o1 q+ g! Z! M' K; u7 X0 M4 X! x document.sform1.checkask.focus();
; C# r6 C: I' \0 H5 p2 Q return false; 3 P' r, _8 ^3 w
}
4 k3 G/ J: p; P9 Z" ^. h if (document.sform1.checkans.value=="") " T& S- S. |; X7 ]. @
{ # J3 M) C" ~: c+ p
alert("您的密码提示问题答案不能为空"); ) y! A% P( E9 \) z. ^3 |0 l f4 J
document.sform1.checkans.focus(); - G' O5 |2 E5 L: j& |7 n. A
return false;
+ m: a% @1 q' V8 Q# s# a }
- M* h# Y6 q1 f# _ return true; ( r( S9 F: W1 ? s+ U8 ?
( m5 {, J( q( b. H$ ?4 G}
. M5 g$ B& \$ F1 Y5 s</script> |
|