|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14403
- 金币
- 2487
- 威望
- 1647
- 贡献
- 1435
|
这个脚本对你可能有帮助:: {% Q, g5 H, B7 Q4 w: N) o
<script language="javascript">
) _1 x; M. b( efunction IsDigit(cCheck)
0 D; S5 Y- H8 K; X$ |3 D y9 t {
2 `! g8 L9 a5 a; @! e/ z return (('0'<=cCheck) && (cCheck<='9'));
+ ^- l4 |. ?; A0 Q6 p; C0 A }
% G' X( K' j6 ?9 Y/ g
3 C. W& K% v& G2 `function IsAlpha(cCheck)
! K0 G0 C; T! V3 s { , R+ p, Y& C, L) g0 }
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 ]: `, K3 P, ~1 U3 u
} ( E, j9 M0 N9 P4 Y0 P- e
9 g; T! p& p! o! O3 b' ?function IsaNull(cCheck) . Z3 w( z# ^+ n
{ - d' p0 t0 T h4 e9 X0 U5 Y+ g9 q/ t, D
return(cCheck != " ") 1 S6 p8 R- y7 h1 N
} , M0 h* H0 ], U# q( B* w
0 n6 ^7 Z4 C9 X6 T
function checkform()
: h: M W& z s( R) Z, {{
7 R0 d. P& ]/ ~# P. t; X id = document.sform1.id.value;
* E. R& b6 j- t if (id == "") , N- U8 `$ v2 ]) d1 B: z# q" J+ F, s
{ , X$ P0 `2 f# y) z% b- W9 m9 y
alert("请输入注册名"); ! U/ G a4 U5 X3 V1 X; Q) P
document.sform1.id.focus();
% x- {9 O. E6 h return false;
3 N, M: r, l5 ]1 X9 l$ W }
s+ A9 ]7 m& _5 v + \- F: p& A$ Z4 v* C
for (nIndex=0; nIndex<id.length; nIndex++) & @& [! p$ o$ R, [
{ ; G, l3 d1 _% h0 C) n
cCheck = id.charAt(nIndex);
! \5 |' D! n1 I3 _5 U if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) - {* |, d( |4 W X
{
[+ e* W _, v alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); + Q" a! N8 I7 i9 W. U
document.sform1.id.focus();
3 U* F" u! C+ d4 ~' {, Y' {0 ] return false; * K) h! Y% P X- y6 U% `
} $ q8 j" L$ S0 {
}
1 d" `* M( s$ A5 S5 V2 V0 b! w( v chineseid = document.sform1.chineseid.value;
- |' m3 w8 ^. x4 P! D D6 w* Y if (chineseid == "")
) c( U" p0 E0 E& T. I( i4 j) p4 I { + W/ V% a Y7 x8 ~
alert("请输入中文昵称");
' ]8 F( Z. g1 G" f2 Z document.sform1.chineseid.focus(); * s$ [2 V" z* q& O ^& I
return false; . n2 r3 w+ ]; |- L5 B
}
/ b1 L0 {% d) X0 m' S' E0 o password = document.sform1.password.value;
* t4 l7 |7 @# r1 V- P# g if (password == "") 8 s$ l$ q0 V/ t9 S
{ 4 r9 H; \& j7 s
alert("请输入登陆密码");
! l# x! ]6 O3 X: s4 W document.sform1.password.focus(); 4 Y4 \; }) _7 l( w
return false; " s9 F: K9 M% _# ~5 z- L: Y
}
4 p# ?% _+ o) B/ Y3 `9 t password1 = document.sform1.password1.value; . l& `4 q9 a; B5 N5 f
if (password>password1)
1 b: s% B, Q* f' S' L4 `7 ]8 g {
. j k4 {* N4 N$ x; P U alert("重复密码与登陆密码不相同"); ( W i g" o3 h" N8 w
document.sform1.password.focus();
# B( T( h( n' x6 U' F1 z+ A+ S K& o document.sform1.password1.focus();
4 m: {' M# Q6 T0 y return false;
( ^. n: d8 l, W# E" L4 g! M } * ?" F6 a. l8 |4 f) B2 `% C; a$ ^, o
if (password<password1)
/ R8 Z/ P: K9 S9 U {
7 r' d$ ^' k; v2 p/ O alert("重复密码与登陆密码不相同");
3 \; g) w% Q9 b2 G2 R* W document.sform1.password.focus();
! `- y7 ]4 d2 Z! W9 z document.sform1.password1.focus();
- O: f. J% X4 ?2 ^/ R ` return false;1 O2 h" P, r9 l
} 5 H$ a) ^& i$ `1 Z A! C
if (document.sform1.email.value == "")
- ?8 v- B9 N5 |2 @9 F$ z" E/ x {
/ I8 q b; ` E! v2 W4 M' d1 k alert("请输入您的E-MAIL地址"); 9 c! B0 J. ~/ k3 h" c8 }4 `
document.sform1.email.focus();
4 G% }4 a. t2 E0 l: ?+ U return false; , Z9 z, l7 a2 x, A6 _' ?' v
} , k2 V/ R0 w4 f$ M4 u
" j+ ^5 u; [ z+ A7 i& I
email=document.sform1.email.value;
# K) d" v: o( u8 N emailerr=0 - v' X. B9 F& Q& w5 i
for (i=0; i<email.length; i++)
% W* o/ B* H: r h: ^# U9 M1 W$ R( T {
% Z, m. K7 l' }$ j% ? if ((email.charAt(i) == "@") & (email.length > 5))
( ?% D- s* @2 s/ S: v { ( d/ P3 D0 O) D% }7 O# q2 [' l) s, O4 @
emailerr=emailerr+1
% C2 X X/ j& q& o d+ I/ B }
0 V! x# W$ O+ b8 t# o% f3 R( h }
m+ R/ ]- p9 q! V$ h if (emailerr != 1)
# z" D+ V' H6 \ @+ r. R0 { { 8 t" C& `; ]( i' t, ?
alert("请输入正确的E-MAIL地址");
) J8 O& b' N5 P/ S' C2 H4 Q" E document.sform1.email.focus(); : i3 s4 J n9 \' r+ I" m8 p
return false;
6 D+ f2 v3 m; h/ K+ X0 p }
+ ?+ @* H& i0 f0 t# ?+ N 9 a, d$ h* p2 L
if (document.sform1.checkask.value=="")
$ V5 h% |+ r- z1 o: @8 m {
0 T8 q) C5 F7 w2 W, M! J- @ alert("密码提示问题不能为空");
- X1 \+ A# {0 b2 \& K" Q0 |9 c document.sform1.checkask.focus(); 9 Z7 X# @ m4 V6 [( u
return false; : A; g& Z! P) A: d
}
( U# G6 h+ d" [* T( a if (document.sform1.checkans.value=="") & `, L; i/ B8 v# _
{
3 m4 I" J* d3 ?& q! l9 X, W1 h$ g alert("您的密码提示问题答案不能为空"); . J1 I8 G# K# \! Q W. Z
document.sform1.checkans.focus();
~% @% s' p# {3 |6 }. t return false; * p* m5 H! ?; c) w" @+ V' @
}; D& V8 E' B7 O8 y" v: r* O# U
return true;
' V) c. B3 @& ?- U R
* `) X8 ~# X. f' z; T( R} % b" B: }) [2 `( `7 M& B* G$ z
</script> |
|