|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:- W7 r; H. l" e" _
<script language="javascript">
8 Y. P6 z. C) c& G7 Nfunction IsDigit(cCheck)
8 j) F4 ], d3 W5 I5 O. E6 w1 { { ( J" e1 Y8 Z2 v @
return (('0'<=cCheck) && (cCheck<='9'));
) N D1 ?5 @2 @9 N& N2 X2 N; W/ R4 L, ? }
6 o. ?3 M% ]9 a- w * }$ A! _2 q$ W# F
function IsAlpha(cCheck)
" }8 y5 e' q- K& C/ C3 e* J- @ {
9 M' Y( f: |: w: A# }4 E' H0 g1 r* U return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 N! I2 s- g. z$ B; D3 L) T }
6 @4 @; ]2 N4 G5 h 5 i( e. y- M& i0 x4 i# }) ]0 g
function IsaNull(cCheck) : h% I3 t, F2 H5 K6 g9 i
{
2 U8 i; }/ W4 s3 C& Q return(cCheck != " ")
9 k+ K, Y8 @& A2 d& ]% C } : T: r9 u! U) n9 a* @4 m
' k, O7 L4 f+ ~- `4 F: R9 I! }% ]! Sfunction checkform() v8 ?. U4 E' d; }0 U. ~) k' F
{
# |( B7 P: X" J! V2 l6 H3 ~ id = document.sform1.id.value; ' J% q% y* e3 t
if (id == "") 8 |2 ?0 L% A6 N; }0 U: ~
{ 8 @3 a7 S1 O, D/ t
alert("请输入注册名");
0 w! D( y' U$ y/ }5 }9 G7 @, |9 C document.sform1.id.focus();
& Q7 z4 d' K. t- p$ X+ \ return false;
4 _; f4 F& I9 o } 7 M# D+ j* u, B' X8 Q
* w5 ?$ t/ L* N) ^6 Y for (nIndex=0; nIndex<id.length; nIndex++) 0 Q, V* h' ~" X; R
{ ' U2 _% P4 g/ R/ n' ]' D7 {
cCheck = id.charAt(nIndex); ; q# H7 T% X. U* F
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 q4 h* Q6 w7 I! S2 F {
; W% N2 S# x5 d# u! C7 M8 c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
$ j! h% @3 v# h: M8 \ document.sform1.id.focus(); 4 h. u1 z; C4 D: z. ?! T* I
return false; $ a0 Q( @% m! p2 m( E0 L) L9 N/ L/ \
} 7 K8 x8 R$ y5 Z( X1 J6 A; B
}
; P4 p5 x g' A$ D! w chineseid = document.sform1.chineseid.value;
% z, l: N4 ]7 f- T# J if (chineseid == "")
6 G2 y! v% ?: b8 {/ t) ] t {
$ X7 d# j+ |) b1 j) n alert("请输入中文昵称");
: y; M& T2 g* O5 i) e' O9 N document.sform1.chineseid.focus(); 4 O5 ]: c7 c' v+ z0 U S! ?
return false;
( y- R' u! D2 i, v* N } 3 n" T" D; Q$ Z: n% `
password = document.sform1.password.value; ' F$ a ^- n* N1 |8 h5 M
if (password == "")
: @& X6 d% A7 h6 G" y {
& I- E3 R7 m* T( U alert("请输入登陆密码"); & D9 I9 }; t0 C1 @
document.sform1.password.focus(); # @6 A' a1 R2 s' o* B6 l) I0 M; e; ^
return false;
S0 i1 S/ e0 H1 q. q$ L }
4 j. V% k& N7 n) ] X- x3 W6 f password1 = document.sform1.password1.value;
) n# A0 U' K9 y6 Z+ O! z6 I if (password>password1)
, _% a5 C4 F0 Q% \- k/ o {
% g# {0 F5 E0 E' e alert("重复密码与登陆密码不相同"); ' \% k- Z7 B$ o
document.sform1.password.focus(); ; b w' C7 o* H+ D( i: o
document.sform1.password1.focus();
4 U6 m k* V9 x( p' }- J; }1 c0 Z return false;
& Q# `' |. S/ a: a } # G9 w8 U" ~7 ~" J$ L4 d- t
if (password<password1)
. U2 v4 h7 B e) C( A7 { {
+ E: v9 N2 X- w& R6 e8 X% ~ alert("重复密码与登陆密码不相同");
7 a$ k) O: J4 {0 g- q# V document.sform1.password.focus();
, `: K$ E* V2 _ document.sform1.password1.focus();
: p2 U" r r( I r8 W4 |: T, a return false;% G- Q6 Y2 M$ A& R, c' J
}
5 Q5 s. ]0 u+ h if (document.sform1.email.value == "") 0 j, A2 i) H; X; y8 I0 O
{
3 d: A5 d+ l! e3 E0 | alert("请输入您的E-MAIL地址"); 3 _3 S$ v* `) h6 \
document.sform1.email.focus(); $ ?& ]0 i i! `4 Y% D
return false; f4 k# W& c0 q8 N. v9 n
}
% N1 n$ k: Y; ~! u) T" P' S; ^
5 C9 ~1 _+ c3 s( |1 r1 ?% ^ email=document.sform1.email.value;
) _- R! K. x( _1 @ emailerr=0 7 D* ?$ o; t9 s* b3 N& ]
for (i=0; i<email.length; i++)
' J( e, x8 B# R: m {
( ]( B9 f- `. I6 c# U9 r5 i if ((email.charAt(i) == "@") & (email.length > 5)) 6 v; {2 Y* v, F {, J I
{
# L. E- V$ `, b6 A7 K emailerr=emailerr+1 # Y* w; T4 T( `3 j) [9 L
} / C3 D$ h z# \7 ~5 |3 i! r& A) G) A
} 3 W2 J4 n% y& |! [
if (emailerr != 1)
U2 s7 Y n( e# n7 W% N1 V { ( Z! W9 H" E8 W
alert("请输入正确的E-MAIL地址"); 0 q4 r8 ^/ G' I a
document.sform1.email.focus();
7 i, V) a* [4 @- e return false;
( i8 Y8 Z- g' k1 u }
2 W9 }: n0 J p; B * B# y: a0 ], v' L8 X3 T% k( v( f
if (document.sform1.checkask.value=="") 1 J7 E ^% M f" I. q
{
0 u% ~. r& n; E alert("密码提示问题不能为空");
! E+ q4 \& W! T5 o) a! K7 [ document.sform1.checkask.focus(); ; a! M( ]" q: V% R
return false; - P7 ?0 `. R s' \
}
) ]6 N: |; [; {: o9 H$ n if (document.sform1.checkans.value=="")
% _# j* | s0 _) P! |" H4 `4 f { 2 k. D9 y2 T5 @- i* W
alert("您的密码提示问题答案不能为空");
/ C6 t3 G$ o1 P6 m document.sform1.checkans.focus();
( ]3 p- S. D. R! ~1 W E return false; 5 s9 V5 T) u! W- ]& U" o. U7 S* U% M
}5 }2 D7 N& ^1 {6 P/ P" Q$ A" w
return true;
* q1 q, }: w6 o3 P; ~ 9 s# L3 I7 ?2 i5 b3 c, d" \/ X, Q/ s
}
. K2 g, |7 P& T. G$ i5 K* E</script> |
|