|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14365
- 金币
- 2468
- 威望
- 1647
- 贡献
- 1416
|
这个脚本对你可能有帮助:7 g f* C+ m4 R/ l% G( v
<script language="javascript"> ; s# J; R- T p' N
function IsDigit(cCheck)
( b2 c) F% x9 E, _2 S, b$ p7 f { 4 x; @' V5 o9 p* W8 d
return (('0'<=cCheck) && (cCheck<='9'));
/ ^1 H- [, T: D4 q; _* u } 0 Y+ s/ U, G# G! r/ m# X$ H) n
( k6 U( K( b7 g" gfunction IsAlpha(cCheck)
+ T( }5 d7 w# c2 w1 }5 Z {
/ g5 g1 U4 U( H* h return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 V P2 V5 S- b0 x4 ?
} 0 L% |+ h+ C, Y
g/ q. B# R% i" ~
function IsaNull(cCheck) + O0 h* j9 j# i- H0 }; p
{ ( M( ]4 c/ h6 G
return(cCheck != " ")
5 W2 y/ |( u& h. C }
7 {1 R. W0 B {% {1 G R# D ; O5 K& p t( F7 a
function checkform()
% t6 X" P5 M' d2 P# i) [{
: l1 X& D4 _) H5 @/ B id = document.sform1.id.value; 6 r' C/ ^8 B9 m6 r3 U
if (id == "") 0 G' k4 }: D$ @; Q$ d, c( N7 ~2 _
{
5 V# z7 f2 g. N7 K% N% _ alert("请输入注册名");
6 T L; { |0 {8 l8 v5 Z document.sform1.id.focus(); 1 u }5 n& r+ W% ~8 u9 h
return false;
; d6 T) q# N' L8 V9 T+ o } . x: c( C% r: l
) p$ w' }8 k0 H4 A) l
for (nIndex=0; nIndex<id.length; nIndex++) ) S% }5 T3 R4 d5 ?
{
9 C$ C, E$ g- e+ j* p cCheck = id.charAt(nIndex);
# ?5 s H5 i( A. T- @+ o1 P/ f+ W O if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 L8 ]- T5 L) `3 w i' a { 7 O n! n4 @9 w0 s" y
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); A I5 O/ A# `
document.sform1.id.focus();
# B! o4 M4 ]( c# u$ y' _' F/ g' n return false;
; x- I3 E. }9 v! M) | } : O7 M) a4 }! o7 o8 K5 v) f
} ( t6 A) S! a7 ~( i8 x
chineseid = document.sform1.chineseid.value; ( ]9 I# _' X; @4 R0 e9 e ^
if (chineseid == "")
4 R# |! {" j7 n5 N, m0 | { ! e4 W: r1 o1 y6 k
alert("请输入中文昵称"); . z, L6 r* ]* c# `4 E `' K
document.sform1.chineseid.focus();
3 ^' d; G- g5 f/ p0 F return false;
# w# j. V7 v( R! \3 \ H }
, N* T% R1 l2 Y% { \0 Z9 G password = document.sform1.password.value; ! v, v+ L* ~# |& @1 }: g
if (password == "")
2 k$ @* R5 o: u, C {
. I7 P. Z0 }1 o8 J alert("请输入登陆密码"); " M$ l4 ^* c: e8 A0 ^3 Z" M- b
document.sform1.password.focus(); 8 r& E$ [; d: c: Z) ]2 c8 r5 ]
return false; - I# |& A( K! h/ F" ^3 e- q
} / Z1 S: G8 i6 y, ~
password1 = document.sform1.password1.value;
0 l, B% t/ L& R3 @5 q if (password>password1) ; T1 r# o3 q5 l, l' }5 j$ C
{. k& d1 |: x9 X& T# M3 n% x/ I# x8 S1 ?
alert("重复密码与登陆密码不相同"); : L1 R" k, T' ]) m9 \
document.sform1.password.focus(); 2 A \" _- B _; E1 P, `
document.sform1.password1.focus(); # Y7 x! D% y" b1 o; K8 ~
return false;% [4 _1 S& {5 k$ d3 _# s
} 7 x' K* `7 ^' f
if (password<password1) 2 x+ j$ a/ ~8 E4 w& W
{0 F) R, i/ \7 [1 M6 L
alert("重复密码与登陆密码不相同");
. }+ W) R5 g `% y document.sform1.password.focus(); 8 {3 s: f8 j, M6 i6 m! [0 l3 L4 e
document.sform1.password1.focus();
! F8 G% C' u1 f2 A: r. j return false;5 Z1 @3 f# x# b
} ; ~. v8 O- @, a
if (document.sform1.email.value == "")
; i4 {+ `2 z/ }0 C { / ?0 z* ~& D0 K0 \ N0 k
alert("请输入您的E-MAIL地址");
[- f( n+ `- @1 i {6 r document.sform1.email.focus();
& h3 d, s H8 e" c7 D k return false;
: O! d& r! r0 d {1 ~+ v! @5 n3 o }
& [0 v& s* @/ w, V; l4 }
/ \- d, v8 [6 s0 I$ K6 E email=document.sform1.email.value; : Y p P# a: U- c, W( |; i5 k/ K
emailerr=0 r" G2 b9 I2 O6 h, [4 F, ^
for (i=0; i<email.length; i++) 9 e7 [) K! Q- Y& O. ]
{ + {; l: \" u; S* h% r- v
if ((email.charAt(i) == "@") & (email.length > 5)) $ K; c0 O3 }# c3 Q* @/ n7 @2 A
{ R8 F9 u; f) s- l
emailerr=emailerr+1 $ Q; u+ L0 f8 O! ] q% G2 c
}
2 @6 i" X+ R' N; W! L( o) \; H8 P } 0 d% G- G. W7 Q
if (emailerr != 1)
# ], r' H9 d! s& @6 t {
- [; [( ?1 V, m- ^' G* d alert("请输入正确的E-MAIL地址"); ; }& N! i( ^% ]; i' |
document.sform1.email.focus(); K5 F) Y T% m8 u/ [3 s2 g
return false; 0 A) {7 M/ O0 Z$ `8 f8 @4 h5 d
}
6 |1 L* U- a9 _% ~! [" i: D
3 |, N! W6 r0 o% _ if (document.sform1.checkask.value=="") ; R# K# _8 Z+ i+ |7 B$ w! W
{
7 f% r8 }5 l) s0 o. B alert("密码提示问题不能为空");
, N. S* ]0 ` ~9 X- ` document.sform1.checkask.focus(); " F+ r6 z* V7 k7 j
return false;
( @! F3 F/ t6 v; o' O$ H }
4 g: T+ K% y+ q/ V5 i' a: E. F* D if (document.sform1.checkans.value=="")
+ @: c7 c1 R; t2 l$ B {
8 H1 Y( y( G$ I4 |7 Z% `# S alert("您的密码提示问题答案不能为空"); 4 I% M* W4 f9 m4 w' o' Y
document.sform1.checkans.focus();
! a$ j9 g( c: c5 _ return false; ; P8 V1 p$ k( `# A( e, n
}7 M$ U) U1 v9 S
return true;
+ ^ Q% e- d3 d3 [2 ^% v; x
6 e( I; f0 D. L} Q/ R! e' E; G# @
</script> |
|