|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14419
- 金币
- 2495
- 威望
- 1647
- 贡献
- 1443
|
这个脚本对你可能有帮助:# u+ R# h9 p$ @8 n
<script language="javascript">
: d- L4 ]/ M* l6 ]0 F# L7 D" D; P$ E2 pfunction IsDigit(cCheck)
6 a0 G S7 i- {3 z/ L* {) [ {
$ c+ |: }2 e, k. y* { return (('0'<=cCheck) && (cCheck<='9')); + t* C. N1 k! T6 p9 T
} " _$ d+ k; Z# ~+ P3 s3 U' F- p
1 y' n8 B) F& R7 Z- q( Ofunction IsAlpha(cCheck) 7 x9 N) _! {6 a# O
{
$ q# r0 c* W) Q" u return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 7 D$ j7 U. _; V5 G$ ?2 b S; A
}
' O6 O- k: V o" N6 ?7 ^4 F ( m5 i& R$ g1 T( Y. t1 k: D+ R
function IsaNull(cCheck) - T; r# O e: }9 Q
{
3 ~& x6 I$ |0 W return(cCheck != " ") _. P7 A$ n, G
}
+ a" a) x% B2 b8 q/ T0 i
* S. P$ h- Z C" g# {7 J2 z+ O% qfunction checkform() 5 x2 j& F. l4 g; A4 o0 K
{
& o; H, I. i; g- \5 l- g# [& r- R id = document.sform1.id.value;
' f6 x$ ~+ @# k* B9 g! o* V7 G if (id == "")
6 a q8 G. G) I; Y, l {
1 N0 P& i9 S& T9 L4 `1 `# q alert("请输入注册名");
. G5 ^0 V) ? a3 k document.sform1.id.focus(); 3 d6 p, d9 M& v
return false;
) z4 W3 O) J. C- t( a# M9 U( L' o } & j7 {3 v1 m2 p$ T' a- D* o! E
+ r) w8 c) ^/ z8 S6 K for (nIndex=0; nIndex<id.length; nIndex++)
% _3 K8 N5 |6 S+ _5 O) K, U {
% |+ X. x: ^9 F0 O( N1 a' { cCheck = id.charAt(nIndex);
: }3 j* l( F6 V if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 8 D1 e, O8 G' B8 A9 h: u0 Z
{ + C# I( v. \" x( F6 B- P/ s% m
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 0 @2 s6 W+ C, u5 i* F6 n4 I
document.sform1.id.focus();
, S' M: B, K3 J$ M8 g return false; 5 v n+ ]& U% F" i& F' i
} 9 P6 P* U( u* }
}
3 h, N# x; H. J' D2 A% L" V- N chineseid = document.sform1.chineseid.value;
3 ?$ E, Q( \" {9 u( x: Q if (chineseid == "") 7 M4 [6 B, U( K
{ : g% W/ f1 y: u
alert("请输入中文昵称");
6 O% e) K! y0 j' g5 A. I$ c document.sform1.chineseid.focus(); & ?0 s% a% J: x+ T; J, K0 h
return false;
' d/ Y- E1 V$ d; l' S }
5 i: s* K6 i$ I7 k/ A3 a! u* Q password = document.sform1.password.value; # L4 p6 Z3 O( a( Y w, c
if (password == "") ! Y4 r& b3 Q) k, i4 q
{
; p- h! r/ d$ A% Y4 O5 `' B1 ^# u alert("请输入登陆密码");
0 X, f1 {6 `- U" i" S document.sform1.password.focus(); 0 G' W+ w/ m6 n) O, E" j& I' J
return false;
0 K5 M$ Q4 Y/ ~7 |9 C; M }
: n! G0 x. K- N; F/ ^8 x password1 = document.sform1.password1.value;
; t/ R, t d- c if (password>password1)
) [- J% e9 w- V8 l* i8 z5 { {) }% g' R1 e, z' @0 v
alert("重复密码与登陆密码不相同");
2 w4 Y' \, h4 A0 [( } document.sform1.password.focus(); + B: a- c' A% `4 x! t; x' ?, G
document.sform1.password1.focus();
! u! s. C6 `" {' G" q return false;
2 O8 A* T6 R$ N# J7 ^3 { }
4 {( X) i- i1 v" c2 Y: Z+ gif (password<password1) " Z# b6 G( Z# H. [7 }
{, M7 A4 C3 v. m$ T. [, W" U
alert("重复密码与登陆密码不相同");
5 z/ N. X7 {0 ?0 R+ f' J! p1 N) B: f document.sform1.password.focus(); + q* U7 f2 n; @* b, [9 d6 i/ p, H0 P# q# @
document.sform1.password1.focus(); 3 f' u2 @# K2 N* i) r" S; b# X9 C
return false;4 d, {& {- }. U+ [8 ~4 o9 m
} 4 f. u! N: \/ M6 Z5 q4 d
if (document.sform1.email.value == "") . h \. R1 j. e
{
0 y" Z) T4 ^0 o9 K: `0 [ alert("请输入您的E-MAIL地址"); 7 D L$ W* O5 J6 {0 w `1 x* e
document.sform1.email.focus();
2 X% f5 v! Z/ z! ~3 U return false;
) @- V$ S) E# r' {- I$ ]* b3 [ }
3 h& h0 I" t0 d$ G z ; c; ?8 i* r# m& |
email=document.sform1.email.value; % H5 ?4 _2 e5 r, N
emailerr=0
4 ]! W3 l( G& c: U b for (i=0; i<email.length; i++) ( T; w, v$ \8 q
{ & A m& T+ z! t6 v
if ((email.charAt(i) == "@") & (email.length > 5)) , A' Z: |& Q% J, n1 q
{ 3 o! w7 [4 Y( J6 ]% s
emailerr=emailerr+1 3 [$ t9 ^2 ~5 X* K. C3 q
}
3 L5 u' L5 z, v' |9 X }
$ G3 H1 p8 P3 I) F7 [1 Z; Z if (emailerr != 1)
6 E- {: B* |& t2 I) I7 t { 9 v8 _, @ F$ T$ a0 L' X. h
alert("请输入正确的E-MAIL地址"); 0 }+ `9 r7 F. Y4 }% L& y9 h
document.sform1.email.focus(); " f, N6 C" o5 A6 v
return false; 6 h4 V/ K- R5 E1 |' V
} . s( u8 u# G9 E0 @
1 N' d) z" w. N4 M: _3 y% d
if (document.sform1.checkask.value=="") ( G% l7 ?# y0 b# u
{ - K, R: a, ?5 M, Q% @0 r/ } q
alert("密码提示问题不能为空"); % B7 d7 h1 N4 s0 I
document.sform1.checkask.focus(); : E5 U% `. x' u, R
return false;
0 f) n% s2 H+ ^- G3 G6 y }
; P) V2 A3 V" ?1 q, E if (document.sform1.checkans.value=="") 7 B' p# s5 i0 n% {$ q( J3 _
{ ! Y4 M! d; @! I* i; ]
alert("您的密码提示问题答案不能为空"); 3 J; b% o: l6 \% x, O
document.sform1.checkans.focus();
% z2 r. h' y- H6 y; b" s$ | return false;
" J h9 S- D: B) x }
2 x% j" e8 r- L- W# H return true;
- a7 i% ~% I8 T& z, ~2 j
+ g5 r! P9 c8 l0 }}
* Q9 e+ Q! h5 } j; K- o</script> |
|