|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
这个脚本对你可能有帮助:
9 K: i7 g" f4 n: G! @& @. o<script language="javascript">
3 B$ ?% @, \3 |1 J9 `function IsDigit(cCheck)
; A# N) u" t7 F5 D5 @/ V: C2 Y {
. l# g8 i5 X+ K! V# c G2 B. [ return (('0'<=cCheck) && (cCheck<='9')); / G7 x# X7 _9 g* l* f) u5 Z
}
. Q9 O: Q2 T, X- d; }+ r
' N6 k7 `6 L! Q; f/ l( W# Afunction IsAlpha(cCheck) ) |6 D+ G3 v$ l; C9 D2 z
{ ( F! H% A5 [+ E" P
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) / s g+ u4 H G0 o. q7 J% L5 B
} ! a$ m! _6 q( X7 r) B7 i! \
+ A8 m: b: K- ]. _* c
function IsaNull(cCheck)
% u; e7 S6 Z s/ T b5 C {
. u+ ~0 x& d2 ~6 u+ r* I4 { return(cCheck != " ") + ~ L% a. p1 f8 z) O& m0 G
} 4 O& x7 m+ L/ |. h
! a+ Z! I& w) p! }! U: ]function checkform()
. c: x! `! e, g& Y{
3 N! [" L1 G# H. X id = document.sform1.id.value; ; {( |7 B4 Q% K& u
if (id == "") ! L6 P' c! L) g# b: q9 W
{
7 s' x- V$ N$ |9 P4 S alert("请输入注册名"); . ?+ g( c; f2 e5 P
document.sform1.id.focus(); U" ^$ s g7 f2 x3 n
return false; 1 `! K# |& T& o- X+ a& L$ m& z
}
: X/ @4 f# Q" o$ }2 ~1 w
* E$ e% S+ c8 s for (nIndex=0; nIndex<id.length; nIndex++) 6 P( r6 W; \* M7 B& R* ~
{ ( D7 C R7 c' _' P$ e& Q2 F( L
cCheck = id.charAt(nIndex);
$ s& u5 B6 h* |3 `" O if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
$ T" u, R7 P7 Y0 S5 H1 p( \ { $ e y2 I4 _7 x6 ]$ D& `7 H0 h
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); + y/ ^9 r! x' D% L: K
document.sform1.id.focus();
7 G2 u' E5 ]0 B7 I return false;
1 `- \- i9 s$ J7 V4 s% { } ' o! f5 R# o' T v; N$ P
} 9 P6 P7 _" m' U- a i: Z+ b2 W
chineseid = document.sform1.chineseid.value;
! V5 T" X0 N0 G8 `4 D; U7 ?; x- E if (chineseid == "") ( i. w+ h1 }. s: h* n. i
{ 7 H7 }* }4 T, F. c+ F1 w
alert("请输入中文昵称");
) Y3 ?# E& N' V9 u. w4 } document.sform1.chineseid.focus();
: e/ ]1 x. K6 u0 c, f return false;
Q' M# o! b$ I } - U% n g8 d2 s4 t& L8 b' D) W
password = document.sform1.password.value;
: @7 ], p9 Q: O0 o3 y if (password == "")
' r1 K& ^2 {) { {
' {$ M$ Z) L/ t$ T$ M; H alert("请输入登陆密码"); ! R5 _, G [! e9 ^; j) u
document.sform1.password.focus(); * b$ K3 x" ^# m% z3 D
return false; ( u2 D( U+ f! q: T5 w I
}
9 h, M, E* R3 \& Z8 N password1 = document.sform1.password1.value;
7 \1 ^1 u! _ n if (password>password1) , D/ W7 W3 x C; r, i
{
, A5 v' H( ~/ o% b/ B( C5 I alert("重复密码与登陆密码不相同"); 2 ?, W ?1 t0 H/ j0 i! V
document.sform1.password.focus(); ' H" @5 x) r- E2 A, C) K& L* Y: D) [
document.sform1.password1.focus();
4 B) w1 C% ~) q8 ?$ D return false;7 _/ V1 T! D W6 V9 p0 j
}
3 r# T* x6 A: ^" E5 Aif (password<password1)
/ {0 G7 Z! b. ]/ P3 q: H' C: Y0 E {/ k4 F, i+ p+ H- H7 F
alert("重复密码与登陆密码不相同");
6 e) j$ h4 G: m' M. Z document.sform1.password.focus();
# R4 _9 R6 w% c document.sform1.password1.focus();
- y D2 Q+ u1 w q" a7 S return false;& m2 h w/ N0 Z
} 3 h! J2 e$ g3 a8 n
if (document.sform1.email.value == "") ! {, H) v# t5 T9 t# C) x7 |
{
9 e% H2 z( g8 E7 e; `+ L alert("请输入您的E-MAIL地址");
`: L1 C' x4 Q, N% J( l. W document.sform1.email.focus();
. q. b% b+ h5 s: O& ^ return false;
- s" I. o( }- p6 m4 M$ F } " I: {- `2 b0 X% ]4 Z
- `2 W: `' \# Y0 ]3 y, V J5 \
email=document.sform1.email.value;
1 F9 \& }: c/ | emailerr=0 . g9 ~- O) O/ q5 C2 g, K
for (i=0; i<email.length; i++) # @4 t+ f, J& B, T- A: {# F
{
" i/ b, E, T$ \8 C if ((email.charAt(i) == "@") & (email.length > 5)) 4 c( u2 u% \$ U, r
{ - ^: z) g) W/ u. h' E2 F
emailerr=emailerr+1
: @* e/ P8 {0 j0 V' i4 C } & ]* k" w0 y, G" [" b1 E
}
1 N' E# o0 q+ q3 Z7 C9 B if (emailerr != 1)
5 S, m8 X0 @% ]6 L! n { ; F+ y6 D/ U; x' g2 I
alert("请输入正确的E-MAIL地址"); ' i; E% e4 Q1 N/ w, o: J" I
document.sform1.email.focus(); 7 F' @1 Q& P& v
return false; ( m0 q( ?! K6 l. ~/ l" o
}
5 `8 Q8 Z1 S* w+ d& ~0 t1 s, y 8 E0 \* [" H2 o' Y1 ?3 `* o
if (document.sform1.checkask.value=="") $ f3 `6 p) F6 H* ]# s& [) e
{
0 Q) Z% d7 L l0 x1 Q" s( ~; U, S alert("密码提示问题不能为空");
0 N/ L( O1 S( w& U/ N) ~" h document.sform1.checkask.focus(); " X! J/ a$ u m% [% }7 S) {! T
return false;
9 V1 m4 Y, T, P2 Z } # x! [7 w3 d$ j4 x# j
if (document.sform1.checkans.value=="")
* F7 w0 m( ~' |; K6 C. p. O { 0 v* ?, }4 R6 e* S, s
alert("您的密码提示问题答案不能为空"); 0 u/ L8 S; I' }) b: Q0 f
document.sform1.checkans.focus();
* \) K2 n+ h4 V& ^- |9 C return false;
( i3 }0 Q8 ~( a }
. f8 U$ V* W, j( i return true; 9 L" z2 _7 ^* U
; S% h% F( d. s5 ?" m/ s
} 0 o# ^! T1 e& u6 `
</script> |
|