|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14351
- 金币
- 2461
- 威望
- 1647
- 贡献
- 1409
|
这个脚本对你可能有帮助:4 Z& n! y/ L' V7 Z6 W% A
<script language="javascript">
1 f6 T' i1 U! {8 Wfunction IsDigit(cCheck)
) w. ~$ i T- ?- _! k" ]/ R B( a {
- `3 U4 J! G; F, R" r6 j return (('0'<=cCheck) && (cCheck<='9')); % }+ w! U2 y0 P' y
}
. S! I. J- b" r+ q( F) X
6 q4 u; ~. Y C$ Z6 a' ?function IsAlpha(cCheck)
9 a) y g( v" R& E& k. K { 4 S) O% `1 U; H7 Y! y* G2 z) i$ p
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
( Z. v4 Y6 S; j7 K! [ } 8 w1 y$ ~# ]; A5 ~: z3 Z) a5 E
; t+ g+ J( T6 j2 l, M+ Efunction IsaNull(cCheck)
3 n0 f7 L2 h: ~2 R7 K4 } {
& J& r7 y4 P v P: b" x1 T return(cCheck != " ")
- b' I5 d6 L1 \ } 1 V4 N! x8 T, h. Q, l/ _" q
- ]/ N% \4 E8 l. Jfunction checkform()
7 f7 _! N5 Y6 _- y9 k. _1 o$ m{ ' r6 a, c- |# V( w* H* E
id = document.sform1.id.value; ; i2 z7 f; v& l/ R/ @
if (id == "")
5 O8 O1 v" i) q3 V$ O- z9 N, e" c { + W* a& L8 }' r, O
alert("请输入注册名"); ) f+ T8 Q& k& D4 Z
document.sform1.id.focus();
! E1 O: N/ ]& e6 `1 U- p/ i return false; 6 ~: M: y' z2 [0 K. c
} + A9 E9 q6 c/ e" f U/ \
" d# \$ f. w+ h8 F7 L
for (nIndex=0; nIndex<id.length; nIndex++) 2 V4 s) I% s, d0 x5 C/ B
{ ' c- r7 |5 c! ]* j6 E
cCheck = id.charAt(nIndex);
|# B: ?3 F. S J7 b6 N if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) s7 X7 ~( c1 q6 _% g2 D
{
* \' O. M% k W, W alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); % i0 V! _6 _ R6 ~2 v) P5 I/ k
document.sform1.id.focus();
: b" O, x6 N d! m! F return false; 6 G$ Z3 `& u4 r/ l) q* D" U
} 1 B! w4 v& c+ Q
}
# I4 N }$ U1 ], M chineseid = document.sform1.chineseid.value;
4 p+ |+ H& H/ _6 M if (chineseid == "") " C1 h6 e, o% D8 b7 O! B! }: i$ U
{
6 W+ W2 K1 p( F. ]6 o% J, v5 ~ alert("请输入中文昵称"); 2 z8 R' ? F' Q
document.sform1.chineseid.focus();
- k* _# b- {' @* R+ {" o! Q return false;
7 I4 w" I9 L! T) o' P2 K }
( G' D. B3 d+ \7 R* Y1 n7 R) a password = document.sform1.password.value;
7 ~2 T$ F0 h4 m- N) E ]2 F D% }& [ if (password == "")
: } ~. s) h! ~7 v { , ~2 c9 @1 \+ w! e G- v
alert("请输入登陆密码"); : m9 `/ ^5 m( |6 j
document.sform1.password.focus(); ! R8 x2 e$ e8 H; R, R, B
return false;
% g# T* e4 b: R }
8 l& W' g8 M. A% i# ?2 Q password1 = document.sform1.password1.value; 2 B: @2 Z6 W( p2 u( X+ A: f
if (password>password1) " Z) u. l& F8 x# q: W
{
- A8 B4 G4 A- r alert("重复密码与登陆密码不相同");
# u% k3 {# q' k: c* l9 m' J- r/ S1 I document.sform1.password.focus();
1 i9 a+ f, ?/ i, x& a document.sform1.password1.focus();
+ p5 z: }( V0 Z; ^0 A( f `6 Y return false;8 I- ]! q0 X8 v/ d
} ( ~5 M" G4 Q" e d" I* r
if (password<password1) 8 p' W7 ]. Z! t4 l V5 i
{
* f7 N5 n$ j6 u- u alert("重复密码与登陆密码不相同"); 6 C. K- C! I( S3 I0 X* ~$ Q
document.sform1.password.focus();
! Y; y* |' V; @( e1 | document.sform1.password1.focus(); 4 [' a3 K5 J v
return false;6 B8 p5 ?- u5 g- }$ j
} # w# Q( q5 `- x7 ^3 [( g9 @$ l
if (document.sform1.email.value == "")
e, f# ~: Y3 {, G" l1 e { 3 z4 P! d9 e* y# `$ W% W7 X
alert("请输入您的E-MAIL地址"); % S d8 Y: V5 R5 e
document.sform1.email.focus();
% s, l+ ^, Y5 K1 t; A( T% F return false;
' q! Z9 {: @. j2 L4 \4 n" U8 l- A }
# ]" ^' K5 u9 r- e
, M( g9 F' j4 x0 o, a email=document.sform1.email.value; & A) H. a4 e; S* m8 Z
emailerr=0 4 {9 u0 n" s3 i; m" R. z: _ c) f
for (i=0; i<email.length; i++) " a1 @4 G7 y0 K$ i
{
# W1 M1 P- P; }$ _ if ((email.charAt(i) == "@") & (email.length > 5))
& E2 b: \4 p% Q7 m1 }2 Q { ) ~7 s6 K" I F2 n- {8 v
emailerr=emailerr+1 : O) w% B' A! H) p; w
} , s7 F2 {8 B8 n6 J9 E1 K2 M4 r
}
$ ~' u& ^2 k1 G6 T9 A$ ]3 x if (emailerr != 1) # S6 p) n( @. r( f; c
{
: A6 Y1 d, {% ^% A5 ~ alert("请输入正确的E-MAIL地址");
6 I7 W* p4 i7 y. \' Z document.sform1.email.focus();
* I' d1 ]; Z& h# @ return false; 5 `3 L. n" U' V, e
} , \7 Z3 @0 m9 x
% B" i' K1 h) R8 Q; T# |' a" h if (document.sform1.checkask.value=="")
7 d: \. {- q/ i; @5 L3 r+ r { ) E6 \' K4 V5 ~. q7 e8 B& l
alert("密码提示问题不能为空");
* y& T! `) j2 S document.sform1.checkask.focus(); 1 W- t8 H7 \" H" m- C1 L4 e
return false; 4 l4 t8 v6 C( `9 v6 b; Y
}
) z0 T; y- o) q2 O/ @& f if (document.sform1.checkans.value=="") @ x, h; X1 t- T! |
{
M3 @' F- p" \4 Q alert("您的密码提示问题答案不能为空"); ; O, ?! C2 T9 J. ?& J; P
document.sform1.checkans.focus();
* \1 {7 Z3 c) k# z4 ^7 u return false;
* F5 z( F" T" m. v" W- p }
) P$ m6 a% d9 c! z& ?0 W return true; ' j' K' y2 Y/ R- w- p* Z- U0 e
' B( V/ I, @$ Y, _, k# L' E2 O' r- w} l7 Q7 N) y: h, ^3 d; B0 n
</script> |
|