|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:; l: P6 \/ [ _( t3 Q" q6 k. K+ C
<script language="javascript"> 3 H6 H2 q' w% D3 ?
function IsDigit(cCheck) & Z, ^4 m- F6 J6 `; J
{ ! M; A5 p, m8 {! v: v& g
return (('0'<=cCheck) && (cCheck<='9')); 9 G( x) F9 Q5 f. w% |
}
9 M* P+ q* R' H7 q D$ h
% T3 x5 b B/ ~4 y* yfunction IsAlpha(cCheck)
+ D3 S2 V( N8 O* P2 J, J0 r {
6 Y' H- W. s! @; {% u return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
5 f6 h4 }1 s) X4 P; ~" [ } ' K: a" F2 R/ P' W6 _3 A
" h/ |& V! E) ]function IsaNull(cCheck) + h a, {. {4 ]6 R# K
{
% t6 I4 P( D% o' { return(cCheck != " ") & l2 y* _9 l0 Z, k' R
}
5 E$ m' s/ I# q' T: o
% v( V, P; V2 k& A" dfunction checkform()
" U$ H |2 v4 I; Y{ ' x8 w# ~0 V- C- H: g
id = document.sform1.id.value; J1 y! T; Z [% L. Z% ]4 m
if (id == "")
" k' r7 G7 i$ T/ w; d5 s9 O6 g9 ]( b {
' p1 N# n" R% `; K% f- l alert("请输入注册名");
$ `7 M& ^/ v& p( H: c6 r4 L document.sform1.id.focus(); 8 u, f% ^) x! D
return false;
6 N5 r5 m' V+ ?, R z/ Z7 ]6 \ }
( k$ l6 ~9 `2 v( ? p1 H' \
8 }& { `5 u" b for (nIndex=0; nIndex<id.length; nIndex++)
% `# ^( s: T* R& g8 e { / c! ^1 p" I% z3 T+ U8 e
cCheck = id.charAt(nIndex); : |% a0 ]( {! J+ p
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) _: U# r1 A. C' d/ x
{ 2 c8 d) O B/ G2 K4 x$ O; E0 S
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 8 t$ ~8 h' P$ f* M" ]* @
document.sform1.id.focus();
/ e, v# C, i `8 t8 y$ D, x return false; + I( v1 _+ _2 ~
}
, J" \8 p" u5 L3 Q. O$ d }
& B4 p: f* X# G% S1 M chineseid = document.sform1.chineseid.value; # u# R9 l( f2 Z' X, h: B
if (chineseid == "") - c$ a$ z8 e. r
{ " z. m9 u& F3 B& S0 U8 m
alert("请输入中文昵称");
3 j+ M- t x: m1 T- p) g3 I0 F9 J document.sform1.chineseid.focus(); " S/ ^' ?* k/ U: E; G+ N% D
return false;
! d- [6 e6 v) K2 P$ z9 p } . }# ^) ?6 v+ L3 N Z* i+ l' a$ V
password = document.sform1.password.value;
! q& O; z( k* R! v/ ]1 ~+ J) G if (password == "")
$ T$ x6 f* v( P4 `% @ {
9 Z) B/ v9 O, o% i* h& f alert("请输入登陆密码"); 7 K: ?, B6 G- ^& K; _1 u/ z
document.sform1.password.focus();
- C4 a# \) M! x2 G+ F return false; : w7 U% J* S3 W2 Z: ^
}
/ P' i& s6 T, V password1 = document.sform1.password1.value;
& a/ L: D* d; d6 s if (password>password1)
( F; w0 f; Y% A' |! C: |$ a5 T {
% r# ~4 _% }: B8 n alert("重复密码与登陆密码不相同");
+ G( a1 K6 o/ E/ | document.sform1.password.focus();
. s4 {; U( L( c8 ]* O9 m6 ~ document.sform1.password1.focus(); ' g% d9 \& r: D5 h! Q. r
return false;
1 N7 O8 W1 z" u ]) A }
6 j4 P$ P9 d! ~' d6 s, |if (password<password1) 0 O$ U1 }. i# W2 a' W
{7 R* j- ]! ?5 W
alert("重复密码与登陆密码不相同"); * Y P0 c+ X' Q$ K: d% B- O0 t
document.sform1.password.focus();
' w% t5 [( z% v2 p document.sform1.password1.focus();
) l! {( M+ P% T. t5 X3 u return false;: \$ {3 K! r4 X/ y% {
}
O! m, R% p! m if (document.sform1.email.value == "")
+ |/ G' `3 U6 m- m# z {
L/ M" x0 _9 o& z7 f alert("请输入您的E-MAIL地址");
0 D) E5 d8 z5 m) j; V/ V8 R( U: { document.sform1.email.focus();
0 R2 G* Z/ @: ~# ?, O return false;
$ m0 L4 V* h9 C0 S; h, s3 u- z } ! B6 ]( q+ d2 n& j
& v- d* W+ y2 c. y8 m( N& Z
email=document.sform1.email.value; 0 a7 o* t- X6 j3 x
emailerr=0
3 L" g2 H' F3 A# w+ q3 j" q6 q for (i=0; i<email.length; i++) ; ?, ~( |. i' A2 M. N* a
{ # u/ N: Z/ i+ C T- e' b4 d
if ((email.charAt(i) == "@") & (email.length > 5))
4 l: E! i4 Z+ }: P { * F) w1 O6 P( S0 g6 ~* u. c4 a
emailerr=emailerr+1 0 F ?7 E$ R5 B j6 j T6 F: Q
} ; ?4 S$ _9 l/ I9 [
} & K1 r2 V* i; L
if (emailerr != 1)
8 B4 C. y, |5 t$ |" R$ A { 7 i, K* ^9 K( e; ?! W6 B
alert("请输入正确的E-MAIL地址");
i( D* R/ i+ B& A, P document.sform1.email.focus();
; {' ]: }2 b4 ]* x8 o, D! T1 E0 Y return false; % O" Y3 D1 P4 W8 d
} # v7 \8 S9 D% c5 Y7 n4 @
* s! P8 v' C/ W G4 X4 l
if (document.sform1.checkask.value=="")
! H, X c5 L- t" [+ ^" W# f" ] {
0 t2 l7 k; s4 S2 o/ ^4 ^ alert("密码提示问题不能为空"); 4 R2 b( U' x$ }+ h$ t- p1 [
document.sform1.checkask.focus(); + g( Z. p1 f8 w: z: H8 K; d0 V
return false; * K) g& G0 E1 p7 w: ~$ z4 L
} ! v7 z1 g/ Y; f2 E/ m& [" H
if (document.sform1.checkans.value=="") $ p5 l7 X7 r1 \ G+ S. W7 B* F
{ 9 o* R) d1 }, }$ w# [
alert("您的密码提示问题答案不能为空"); 5 c2 B- S& g% Y4 A; P
document.sform1.checkans.focus(); - h: \$ _4 p8 p/ F
return false; $ _ s; h. K, L8 Q$ L
}' I/ v1 S9 ?4 x# M( b1 S5 D" i6 S
return true; ' _- E4 O/ k2 T& ]' K8 ^
, w7 O+ q( G0 i: ?- N- ~) w}
7 r" t. P C2 _( S, R' a7 ]</script> |
|