|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14411
- 金币
- 2491
- 威望
- 1647
- 贡献
- 1439
|
这个脚本对你可能有帮助:
% A) z, c, ]! z( n2 @& O* U; l<script language="javascript">
' ^- A' Z6 k1 ^9 Y- Lfunction IsDigit(cCheck)
5 `6 W. c* K& E# Q# a" m/ P B {
; e" A# P; P7 z' T5 d X& a; f return (('0'<=cCheck) && (cCheck<='9'));
9 {. i+ ~% p* g& c$ B2 T, w& a } ) s* ?6 x/ b, u8 A
6 j& ~9 r* `( X, e% gfunction IsAlpha(cCheck)
, `. {, I* P) J0 B9 M, D/ F+ D, v {
7 f! O- O. p- T) N return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
8 N" g- y* F1 v2 z- w }
5 I2 f/ J! v' `' J7 N: Z p; l
1 n2 F! ?! b M* q' bfunction IsaNull(cCheck)
0 Y Y/ T) {) m& G; Q { ; T+ v2 y* t7 H
return(cCheck != " ")
6 U; k3 ?! \) G& g* [" @( i- _% P } ( H7 Y% t; l( e9 |/ t; {; t
# K5 L+ X% r3 [function checkform()
# j: B/ T- w2 k{ ) D: X4 K% D$ z' C1 ^, U! j1 ]; D5 u
id = document.sform1.id.value; + j2 Z: K9 p' O% g- Q0 H. w* E
if (id == "")
5 r9 k5 e) g7 A$ Z+ q$ P& \ l { , O( n5 x7 ?6 g* O& ` e: t
alert("请输入注册名");
" G- H: @1 }5 @ o+ W) _ document.sform1.id.focus(); ; h0 \6 Q7 ~ s7 h/ l% m
return false;
# H# S. n2 X$ ^: h" ]- i0 N& f; d }
5 f: s s2 ^$ `2 J* V& W& i 4 A8 h( [! U4 Q! X7 f0 B" o8 X$ D
for (nIndex=0; nIndex<id.length; nIndex++) * u* E8 s' ?4 C% p* H
{
0 H Y8 s4 O }7 N) B, o$ g4 m cCheck = id.charAt(nIndex);
e( x# b8 M) H( v3 M if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
/ I4 @& H# J$ m5 L: p { ; c* q* }+ ]3 L0 \8 d1 n( y8 w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - I8 I) g! G! v! }! ~9 U9 D
document.sform1.id.focus(); 6 B, D; U0 X! D) H
return false;
% T& {+ o7 E) n! Z4 _& k' L- w- V1 z }
5 g6 n- B( E" Z( l4 d }
$ e `5 y7 V) O3 |/ t chineseid = document.sform1.chineseid.value;
! e5 {, \+ a4 W, I* r/ ~2 Q/ R* e' t if (chineseid == "")
( [* z: ^- W0 h! H6 ` { $ L/ I* G( T* p7 l
alert("请输入中文昵称");
# ]7 k3 Q2 w8 i# e5 a) g* R9 x& \ document.sform1.chineseid.focus();
0 H; r8 Z' K) U" g# C5 y t return false;
: t }, U: p- b9 c7 {! ^/ x }
5 u6 X# _% @- d/ N# i8 y password = document.sform1.password.value; ' R& {9 I4 G% ^0 Z( V! B$ g+ |$ Q0 M8 g
if (password == "")
* _0 k+ d" l% {$ e! X0 w {
! t, g' ?& A; j) r- Y" c alert("请输入登陆密码");
2 F9 w) K! l$ l- @+ L& ] document.sform1.password.focus();
2 C4 j8 o u O; x7 b, O7 U$ ] return false;
( e- Z8 X0 j; R- M4 Z+ Q8 E: j } , I& L0 f! i2 Z5 o8 i8 y, u
password1 = document.sform1.password1.value;
: S) z3 Q( L/ U; E if (password>password1)
% s# Z$ t/ l* A9 c* q! U {
. a! D( s/ l" z) B9 t1 s7 @ alert("重复密码与登陆密码不相同"); & Y4 o. F* t' Q. Y! X2 p7 k) e
document.sform1.password.focus();
. l& M1 X& A* [# h% \4 X f document.sform1.password1.focus();
) O0 \& r5 P: p, g e$ V* I return false;+ c, c- i d1 E S- p
}
. W! j5 s1 Y6 r; Lif (password<password1) ! {$ q9 u3 ?! x$ b! s# Q! S0 D
{
6 y: P) h; _0 ]0 N/ ^+ x2 a7 o- k alert("重复密码与登陆密码不相同");
! k7 ?# K2 B7 u6 \9 h: R document.sform1.password.focus();
/ K2 W; M; j( M" u. }. _ document.sform1.password1.focus(); # T7 w% J) O- |+ r5 o
return false;# s# E6 e$ Z0 ~4 n# n
} 8 \3 [9 p0 B+ {. D% J- S* \. T
if (document.sform1.email.value == "")
* Q/ q5 q0 u& k+ B0 o) t' P { 7 i7 z" |! R) \4 `7 g0 I; t
alert("请输入您的E-MAIL地址"); & H, g) b' T1 q
document.sform1.email.focus(); - m0 t) X0 T- |
return false;
/ d: s5 ~% K6 T# s) x% u/ _ }
' a" }' H; d; x / \3 ]+ j7 D ]
email=document.sform1.email.value;
, A# J! X4 J% E emailerr=0 & G0 [1 n5 w; O+ H
for (i=0; i<email.length; i++)
' o! e3 j, v) \. n, P9 Q& N { + t' J# q; b* V0 D9 \- V
if ((email.charAt(i) == "@") & (email.length > 5))
* e/ X6 v' @# }5 X6 O) ` { * G/ X: L+ T/ F3 I6 u
emailerr=emailerr+1
6 e0 M+ G- ]) o' Z8 } } - k" [4 K- v9 u- { ~4 ]
} F. [, Q1 T, H( s8 |, Y7 w- q
if (emailerr != 1) . G& k7 @ ^3 h" Z# o! B
{
, l/ v! q5 \. s# A+ K. Q4 |8 o alert("请输入正确的E-MAIL地址");
$ v# s8 p; D1 E. R( S# l document.sform1.email.focus(); - L5 @7 b6 m# q& ]% j3 c8 D
return false;
1 w5 Y( `' Y1 w/ C1 N } 8 H4 |# { t/ b { o) `0 B% @! N
7 a" e% Q5 B0 F2 |) v6 n6 k
if (document.sform1.checkask.value=="")
" M2 k) r7 y" I3 S) x/ O {
% V, M# _" X" ?- D alert("密码提示问题不能为空");
- z- I; l+ Z9 Q% a document.sform1.checkask.focus(); - Y3 F+ F' \+ j$ R/ ^1 x
return false;
$ U b4 a% d- D1 j1 O) q }
. f. _, `; i2 W( _1 e9 C if (document.sform1.checkans.value=="") ' {, F R4 T! @! V/ V
{
, t* d- L7 f* ~/ C! @$ q* s alert("您的密码提示问题答案不能为空"); 4 r2 j6 o5 x" l$ K4 \+ N& W
document.sform1.checkans.focus();
- E; I9 v0 }+ ~ return false;
3 j* d6 L4 a# a" w+ X }3 D1 M- a2 p: k/ \
return true; % R0 W# E, k0 a. o; r
7 x% i# g7 ^& Z
}
3 E3 J3 D: k- _3 a$ S3 N: y</script> |
|