|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:
$ V* i* N) T# I% w<script language="javascript">
7 \1 ]& Z9 l d' Yfunction IsDigit(cCheck) 2 |- C* t$ I F& w8 r' E. }
{ 1 e7 w1 _7 ^3 t- ? k
return (('0'<=cCheck) && (cCheck<='9')); $ h2 B6 S7 z' S" p. [
} " A( U" o ^7 w* S
0 H9 y5 N0 G" l$ p
function IsAlpha(cCheck) , Q+ t/ W3 a6 Q) |% l* g
{ % y6 t1 p5 k" }! {2 H6 B! A- y% L
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
$ o! p/ ?/ I5 x$ [- a/ u } * P: h( S. c# L
+ c1 e! P+ ?% `+ i8 c2 I# Kfunction IsaNull(cCheck) 6 P) A' Y- F# A
{
: t9 L# `% T& p return(cCheck != " ")
7 f; ?* M2 e! D }
% P$ L) V! p1 k2 `+ B. K
! A0 H# `' S- t' x0 Qfunction checkform()
+ Q3 _: T+ b- y f* n5 q9 Q5 T{ 3 ~3 O! [( f" m2 N, `3 m" f
id = document.sform1.id.value; 7 p. U& C9 M+ Z( Z; [/ c1 s1 L& _
if (id == "")
# D- Z! k8 [+ |9 B. y6 M; R' B { % d+ J" r; c0 i$ d/ ~( }
alert("请输入注册名"); - t) g1 G2 Q5 x# q6 M
document.sform1.id.focus(); 6 s7 {0 m! H" s/ |0 m
return false; 6 T$ C, c8 h& P
}
: M& S" Q0 q. M, a 4 g: z7 \2 d+ n8 H x9 n
for (nIndex=0; nIndex<id.length; nIndex++)
9 F/ w' j! s; C' O0 `. Y {
3 V- x. f! T; Z8 c4 L+ I4 v; L& U cCheck = id.charAt(nIndex);
! ?: x Z0 h; d4 E- x, v if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 8 t6 `2 i4 ~7 @& Z7 ~1 a* z
{ * b: q' h+ T% W9 X" v: g0 S
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , e8 W) m# A0 W% T" V6 h( [
document.sform1.id.focus();
# M3 u8 E6 p9 j4 D5 W2 T% @ return false; / g+ @7 O; k. }0 x
}
$ B" N8 @2 L7 S7 G2 | }
- q4 ?/ W5 }5 d/ n. B' u chineseid = document.sform1.chineseid.value;
+ ` {& M M- O if (chineseid == "") 1 I1 m) Y" D' p
{
8 j' x# c# h$ R/ _: v/ q; b# F1 m alert("请输入中文昵称"); 5 {2 x6 ~4 U' `: x' C, Y3 U
document.sform1.chineseid.focus(); & L) t4 v4 C8 ?: P# ?7 |
return false;
8 y) [( O; I1 o& I( c, X" E }
- I# B/ M; Z0 V. v6 @0 I/ X password = document.sform1.password.value;
i4 i% N2 k- O3 n4 {1 C8 { if (password == "")
2 s* z* T. g6 A, G; Y5 u1 z; p { 2 X& V K: G" o8 X0 ?( x
alert("请输入登陆密码"); ) H, u$ L+ }2 n
document.sform1.password.focus();
0 w6 y, i O* |7 ` return false;
6 {3 C; l) M, ^' j* X6 w( e) s, M }
; V3 _8 G5 g& w( l4 T8 s* A* T4 \ password1 = document.sform1.password1.value; . L+ `# U9 Y3 q8 C# ]
if (password>password1) & p) i* t* V3 H: C
{ `5 B- n$ ^1 h% l
alert("重复密码与登陆密码不相同"); " a9 T9 h' D* a) [( q. [$ T
document.sform1.password.focus(); z' g9 b ^* d- K; Z+ i. m
document.sform1.password1.focus(); ; A. w: {* l$ r- F
return false;
/ s8 s4 \* \( q O1 H. M* W" \ }
: ~" g' S- t; @2 c( Zif (password<password1)
. H$ W2 K- p3 V: j" F7 d {
, Q4 Z- O" y: M4 M* a alert("重复密码与登陆密码不相同"); / W% A. p3 `* M
document.sform1.password.focus(); 2 x+ P& u: a0 ^5 e0 D1 Z
document.sform1.password1.focus(); : h9 X. ?0 C3 W3 n; a/ n ~
return false;6 u- M: a" J$ {3 D7 V% R. w
}
6 y2 e5 J! a6 A if (document.sform1.email.value == "") F6 `+ F2 G2 P9 g
{ o' x. q3 G' r& Y- W9 x) u; X
alert("请输入您的E-MAIL地址"); 2 G; i0 k. {, k, {1 E2 X
document.sform1.email.focus();
4 D" V. F4 r% H- K, ? return false; * v) M3 ~% t7 b# w' x
} % z, P. ]( ~, m, l+ |2 U7 ^, i
* X' E5 ~' M$ \1 v. B1 M0 m
email=document.sform1.email.value; 3 I$ A1 V2 t' W- L2 d4 u' t' B
emailerr=0
# | w$ k) Y8 D3 Q# n+ E for (i=0; i<email.length; i++) & D( ^; A3 L4 e9 X& x; p. k7 m+ A
{ ' u2 \1 H& O; |$ U& q6 G8 C9 Q
if ((email.charAt(i) == "@") & (email.length > 5))
0 `# r8 r! x- f, m. v { 9 @& ]6 ?* n$ }" y
emailerr=emailerr+1 5 k8 a: t8 J4 Q
} 8 A7 u: E8 Z; @; ?4 q
} ! [) r. @3 h: K- s
if (emailerr != 1)
# v! M9 B \( _$ e( g) I2 t( E: W {
0 W0 a9 J1 F% R7 n7 K8 c alert("请输入正确的E-MAIL地址");
/ P' n! V$ X) x: `# c document.sform1.email.focus();
7 h" a f3 y$ ]/ f [ return false;
$ N1 P9 k) f* D p } + @# ^3 r5 ^2 ]- _5 i& B
: _5 Y9 F) U8 c# f" I if (document.sform1.checkask.value=="") % c6 @3 |* M$ Y3 [9 |% E' s
{ 3 Q' T3 A' m, X6 X5 l
alert("密码提示问题不能为空");
1 K) m9 Y/ z* k6 ?+ P document.sform1.checkask.focus();
8 v/ D- B" E0 f" w4 V1 u9 m+ u return false; 0 k* w4 i3 ]. k0 [/ {. H
}
; O# b( q2 G2 b9 J* }8 k: R2 X if (document.sform1.checkans.value=="")
8 ^& Y6 w( c- r% V {
/ \1 t3 t) L q* x7 z alert("您的密码提示问题答案不能为空"); 4 J" z0 p& {) _ h' S
document.sform1.checkans.focus(); ) S+ q- P) H' q( Y
return false; $ w- s" z, h+ Z# x% x
}& u; |% q- V {3 \$ D I+ p
return true;
, o ~! S- i: ] t: V
$ |; z$ @1 N5 K} 3 _: W; n: W6 _' ]
</script> |
|