|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:
, e! W6 X' Q, I<script language="javascript">
1 E! H& u5 Z# i. e) k1 ^& _( x" Ofunction IsDigit(cCheck)
, p2 k( n$ p+ S' h { 4 [4 h$ V. r" c R* `% Y
return (('0'<=cCheck) && (cCheck<='9'));
' k1 q' q, U* J8 E } # P* S) i( K$ v8 t" T$ C% x
% M! @4 ^6 l" M$ J( E+ Vfunction IsAlpha(cCheck)
% E. c* S9 H. e$ _2 w. K { ; v0 w# K5 z! z6 U6 M, l
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
) \ M& K$ B9 k }
1 }% c) ~9 C! N. A# a # o; L1 }' N1 t5 Y( V2 x4 h
function IsaNull(cCheck) H+ w J6 L9 ^6 U4 D: m( x6 R
{
$ C" U; D5 F9 g# ~0 k9 E return(cCheck != " ") 2 J7 _+ }" J0 G5 d# X- A" u& p
}
8 [3 |9 l9 O8 I 9 @( K* t W3 w/ q7 ]$ f
function checkform() + {5 ~6 H: z) W+ T1 |( L
{ . W( D4 e) b g( z6 j5 \
id = document.sform1.id.value;
/ w: `; }4 h6 v" V if (id == "")
3 p- {" [: R! `- \& z& k {
8 U- f/ U5 _5 V! ~0 D alert("请输入注册名");
5 n3 E$ y$ U$ r( P2 s4 f, ^ document.sform1.id.focus(); 9 K% g: t! ?4 { U& D
return false; ' x8 m7 Y8 `8 T! m c
} + [# n \3 S1 q" y$ N( N
! Q* N; S+ x: q1 p& h* t' D
for (nIndex=0; nIndex<id.length; nIndex++)
% M' i6 ?+ D* ^5 b. q2 P8 A { . F6 F4 G* z; Z
cCheck = id.charAt(nIndex); 2 S5 h& A4 a0 G8 s
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' [& p2 b) F- ?- _ {
% o7 g5 v8 O- L7 w X alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); / g$ U8 q, ^6 j7 W( u
document.sform1.id.focus(); 7 Z4 l- v. c6 [( V/ z, \9 @- H* {
return false;
# f# L/ U6 w4 N }
, d, {! _$ S/ Y# \. I" |; Z } 3 v1 Q$ |7 @8 K* C
chineseid = document.sform1.chineseid.value;
- m5 E u8 ^# r& C$ d if (chineseid == "") . g0 l. P; C" V0 \
{ & W/ b3 Y: v5 n7 s* g
alert("请输入中文昵称");
( `8 ~6 e; I* m document.sform1.chineseid.focus();
% A1 x- C8 r! l( g0 \ return false;
0 b$ R s. M s' ~% p+ F0 ` } 2 O% r, n$ o0 Q; K e' W
password = document.sform1.password.value; . Z9 p% t! @, ?2 O, _. S. L
if (password == "")
0 N( g! D3 y0 p- u) T) c {
7 L1 K0 S2 _! d7 ? alert("请输入登陆密码"); # @0 ~& y: m3 a) m# ~$ J, i' @
document.sform1.password.focus(); ! N; ]& z( c& c% R& w0 G* T/ U9 g8 }
return false;
% @( O' \& K, e } ! y' `8 A8 E2 g8 L$ y! }/ J
password1 = document.sform1.password1.value; 6 q( T3 ^* M+ C# {5 n
if (password>password1) 7 ^6 z, s* M; v4 B. k: X8 G) M& ]
{% a- S# Z, U4 C1 O6 `- a+ w: ~& X
alert("重复密码与登陆密码不相同"); / i! ]+ Z/ T$ X! K+ u7 b
document.sform1.password.focus();
( S$ f* U; B& q& }2 d$ {2 d" o& B document.sform1.password1.focus(); 0 i, {$ Q% g* Q/ R- M& b
return false;
8 c/ R, j7 b, T# y2 y2 L9 S } ; d P7 w. z) _$ d
if (password<password1) 0 R/ `: v- G* O5 K1 @7 s
{4 B) f8 r; [; ^/ T8 t3 Q
alert("重复密码与登陆密码不相同"); ! C; O& X% p, T: {. Z
document.sform1.password.focus();
& l! I% V, T! q document.sform1.password1.focus();
, O8 ^) x. g ]+ D, N U return false;' Q- j/ @) C6 i, _
}
9 x/ I1 J( d3 S9 {% J3 G if (document.sform1.email.value == "")
; y% l+ @2 q; x4 ? {
4 R, H- S* _( H% c1 w- @ alert("请输入您的E-MAIL地址"); 2 J+ m! p. f0 d1 y
document.sform1.email.focus(); 3 L3 K( y3 k b/ g
return false; ( U" f9 w. r; t+ @6 i
} 0 P- p) h+ U, v9 Z& W8 T
5 P* m+ h# W" I6 |0 u1 Z email=document.sform1.email.value; 9 z( I& H4 a% n" t
emailerr=0 ) S; e4 o b+ t% y
for (i=0; i<email.length; i++)
4 N" }) w" r7 h { 5 m. ~/ M# c$ L2 G
if ((email.charAt(i) == "@") & (email.length > 5))
; t; X7 Y4 U/ o/ S1 c1 W( ] {
2 B! e- }0 g8 G( @8 R# r emailerr=emailerr+1
2 M; r( {1 t- Z/ Q( n2 U }
( M0 ~6 ]# X- N4 c Q' A }
8 _* a& b. Z' N" a2 |' l if (emailerr != 1)
( A# h( ?. S8 ~- c7 \ R2 f7 C {
* c3 {0 W& C9 \" e u alert("请输入正确的E-MAIL地址");
. S. V1 L- E% b& a( M+ P' k/ ~% C$ i document.sform1.email.focus();
0 e4 h. _5 @ x% k9 d( A) c return false;
8 m0 N# m, j* g } . s' `1 r+ Q c
6 q9 g" ^6 p& Q6 P# M if (document.sform1.checkask.value=="")
. s4 x' _/ l( x6 w) n { % a! i7 p6 a5 {7 V3 V
alert("密码提示问题不能为空");
7 _; p! _; }1 B7 R9 p. c document.sform1.checkask.focus();
. \1 N/ K7 l2 r; s" C" U return false; 8 x' Z U; U. j' j
}
9 \) `1 t% M( w6 c# u if (document.sform1.checkans.value=="") 5 [( V3 J3 C I7 k }8 M
{
- S3 n! [. C( B& g" L0 h alert("您的密码提示问题答案不能为空");
! ]% X4 M: ]& F O document.sform1.checkans.focus();
9 Y6 i# m9 z4 i' q$ d: P return false; . }6 \: z5 F( Z3 t' _
}
o& j4 L' H' H: N* | ^# W return true;
/ h' y! e1 q; h U+ O) h & U4 i5 p1 h" F/ |( ]
}
# B6 x: ]# y4 Z p3 o! g4 b</script> |
|