|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:
`" r$ D2 e8 y% k0 l: H<script language="javascript">
$ K8 Z# o; E/ E+ r2 g1 P: U Xfunction IsDigit(cCheck)
' ~. X5 e5 U) t. C \, u$ r% z0 L { - y5 U5 m1 h2 b3 Y
return (('0'<=cCheck) && (cCheck<='9'));
y6 F2 i6 B" l; \ } 4 @2 l6 \2 \: _5 b( C1 O7 l) A
# c) i2 |2 g* }# Z; Bfunction IsAlpha(cCheck) 7 ?" y" E% v+ r; D
{
) p. `6 ]: M7 @/ T. \0 p. y+ o/ P return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) , n& y: \; ^4 n: u9 ?# l
} : I4 P; l6 c8 \3 }
3 P% x: r$ r" ]4 p4 q
function IsaNull(cCheck) 9 P" t% m* l/ b1 n# c6 R2 ]
{
# \( i6 ]( @0 t1 m return(cCheck != " ")
: u% t y8 m T' N2 p$ ` } - p5 _) A% a4 u! u( w
- J" m9 J u3 ? R/ o) O, G; |$ w. S
function checkform()
; O) {) I; G1 }9 [% i{
3 Q6 x# N; c6 g n' O- u0 I id = document.sform1.id.value; " z3 K0 S. G" @) K$ S, A! K1 h" M7 o, l
if (id == "")
0 e' v( L- `; q$ f {
. ^& {/ ]: h& F alert("请输入注册名");
! t8 u8 d* @- K% X6 S' B document.sform1.id.focus();
3 ^$ x6 y# k; H return false;
# Y# s& }; a! \- z) p& M" A/ l4 p } 8 ^1 y, q8 k! w
$ s, l S0 }3 U& i
for (nIndex=0; nIndex<id.length; nIndex++) 0 Y" ^; S# y' d. d. H
{ 3 x" ]' N' @) K* X2 a# q
cCheck = id.charAt(nIndex);
% Y2 P0 u! w9 C. z' Q4 _' j' v if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 l8 T; Q; G/ ` {
) c9 u# m9 H2 M, N. `. v+ S alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) a- e+ B) d8 t( u4 N, N( z5 B document.sform1.id.focus(); h! z# L% n- |7 y2 x7 c* n% z
return false;
2 H; ?. W( N8 r B2 O5 |* ? }
, {* B+ r- k Q2 T" a9 [4 x8 h }
8 J" d* c( O; S1 ? chineseid = document.sform1.chineseid.value; ) V) h- q( B. ]: X+ V3 h
if (chineseid == "") ' u g* y. h( F; e& U
{
0 @+ b1 E3 ^8 A$ c! u( E alert("请输入中文昵称"); 6 ]* ~, k. ^8 v5 C& K$ I# g) e
document.sform1.chineseid.focus(); . ?& T: i3 M; U8 ]' T
return false; 5 q. P# d. _* p5 p) ^7 i
}
* o) `- | ^$ L4 d. b U password = document.sform1.password.value;
( B. ~& r1 P# ~* S: N if (password == "") 5 |9 V' ?! E0 e" m" F1 o
{
# [/ r) y# v5 [& Z2 N# E. x6 P, ~/ M alert("请输入登陆密码");
+ d; Y# t% m( _8 B" _0 s# D% P document.sform1.password.focus();
( U! `. @5 P& U8 k* A9 k return false; 0 A* J; @$ }! U0 `7 c
}
2 z- X7 }- L% K5 R) M* \ password1 = document.sform1.password1.value; , u3 Z v+ ~ D
if (password>password1) * i1 m. C4 X7 ]# Q# U6 K0 N
{
; e6 T j+ R: ] alert("重复密码与登陆密码不相同");
$ l4 x3 d, b3 D/ H( x9 R( i document.sform1.password.focus(); + n9 f9 W& j$ H% U. s
document.sform1.password1.focus(); 5 G$ T; w; g" K1 ~9 L
return false;/ \5 L& }+ V! |7 G4 m, e$ |( E" q
} % l0 Q0 d1 Z$ Y7 I* i
if (password<password1)
$ x' a7 q, G& g: D {0 ?4 b! ~ F! V) Z
alert("重复密码与登陆密码不相同"); ( T8 B) Z, s4 t: W n
document.sform1.password.focus(); ) u- u* |: d* O' @* {
document.sform1.password1.focus();
- X8 ?$ @! F4 X! i4 p1 C- N$ { return false;' p+ {6 H1 A$ R/ o) l
}
) J! V" b* } K if (document.sform1.email.value == "")
. H/ \0 M5 O" r$ K3 J7 r7 d {
9 ]7 s; t: [7 y C( U6 D" l* c alert("请输入您的E-MAIL地址"); . h+ t, P# t3 G
document.sform1.email.focus();
$ q6 z2 j7 ?* C2 J+ z# m4 M return false;
\2 O2 l4 A4 K$ K4 Y# ]: X2 f) L } & Z5 D0 a& R1 W2 K A) B
2 I _: p# Y, ^& j* |- f
email=document.sform1.email.value;
2 J" h) F5 S" ]& G6 |4 c emailerr=0 $ @* e: Z* g; G5 H, I
for (i=0; i<email.length; i++)
! s# D1 ? O8 L- _ {
6 N' v& {$ e3 W2 v# g% f2 a if ((email.charAt(i) == "@") & (email.length > 5))
0 L- p) f% M4 i8 J2 [% V; Y { " e# F9 d! _( i6 S W
emailerr=emailerr+1 9 R8 J1 q7 e. M) d) Y) n
} $ l0 n S) ?# d
} ) j& R& C* K) h% G8 \; I" H
if (emailerr != 1)
1 @5 \- E7 t1 Z2 ]+ z { , x* ]- C+ U6 h _: R+ ~
alert("请输入正确的E-MAIL地址"); 0 g$ [- g1 s, e1 T. v' ?
document.sform1.email.focus();
( T" g6 h% V. H return false;
9 c* g1 r) x# K: {( ? } ( v5 r4 d. `6 D# U! Z
W1 ]2 E- s$ w4 f) ? if (document.sform1.checkask.value=="") # o# a/ r0 c- E- e9 W, _0 j0 a9 X* X
{ 1 N8 [! @7 A$ i# P2 s
alert("密码提示问题不能为空");
! O/ g9 ?5 d8 z+ x9 I1 g! e document.sform1.checkask.focus(); - R7 E. m9 `0 s" e) t% g& U5 b6 j" f
return false;
! [+ B5 v5 j" c } 9 B( r* x( c& h. S4 _
if (document.sform1.checkans.value=="")
- ?0 Q: N! M- |0 q0 Y { ) q' c/ Q* S9 p2 y4 F% d; ?6 Q
alert("您的密码提示问题答案不能为空"); 1 ^6 a( A8 [$ _9 M
document.sform1.checkans.focus();
) I3 g( e& j( ~. i return false; 4 R- Y, t' S+ Q
}1 D1 J' K2 [9 t
return true; ' Q# L6 [) B4 }5 J* P4 h G
: G6 t0 |: p2 p} 2 m" L- O/ }5 V4 p7 C
</script> |
|