|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14325
- 金币
- 2448
- 威望
- 1647
- 贡献
- 1396
|
这个脚本对你可能有帮助:/ @$ t2 [* z) ~. A
<script language="javascript">
: [' i- |6 c6 Q# R! b! `function IsDigit(cCheck) 5 B* y8 m x7 f
{ : E8 }. E2 M/ `4 d) z2 ?
return (('0'<=cCheck) && (cCheck<='9'));
4 D: F: x1 h. t& Q+ ? F } " \9 P H w6 c3 H: f8 v. l8 s
7 e) i/ q# m% G- efunction IsAlpha(cCheck) 4 U! j7 ^* C' Y1 D8 n, ^5 B. I
{ 8 j# a( D3 Z" J% T2 J* O. B
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
6 \4 l# M$ G5 _) D; x }
# }/ ]" U; g/ ]+ Z
& c; e1 c) B0 I9 I( i$ n( Efunction IsaNull(cCheck)
+ ^+ k; g. Q2 j+ \ {
* D S- h5 O6 t return(cCheck != " ")
; R/ c4 A& ]4 N& C2 j( s% U } 9 { `0 u/ ]3 k+ N: L h
3 t' H x' J0 T; R3 E# Efunction checkform()
# p6 u6 h0 ?" ^* J3 g{
) B/ r# y M# M id = document.sform1.id.value;
2 W5 z5 r9 @( x7 J8 |0 G( i if (id == "") ) Z" H% u- j$ D# [% C! d' @
{
& t& b: ^! X- T7 m6 v alert("请输入注册名");
7 h- ^# u+ u. m5 C& b5 O! j, s document.sform1.id.focus(); % T5 I1 T8 V5 s: }- o7 n
return false; Z* K; _1 T/ }6 i2 D
}
- \$ C5 S5 @! z! n+ b S7 ` [# H5 x0 e" R1 G1 \
for (nIndex=0; nIndex<id.length; nIndex++) z; _2 e8 W3 l7 y) c5 ^% i
{
' p: s0 O' H, t/ M: W1 } cCheck = id.charAt(nIndex); 3 ?% t& v# ~' }" I
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) , L3 q5 x# \% o" k# _. f3 f
{ ! t/ E9 q1 z3 b: [" W- }
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
- T8 O) J6 f) p4 j4 T- t& r+ ? document.sform1.id.focus(); 6 C; u3 y8 r6 ?. Y. J2 f
return false; 5 q. D/ ]& N# Q; {( u2 w
} 5 w% y' B5 b6 M" w
}
5 b' c0 ^9 W% d chineseid = document.sform1.chineseid.value; 3 C4 C1 N( g& s: g7 p, G
if (chineseid == "")
+ U% Y/ F- W- B) h {
/ E W- y# A% b+ N alert("请输入中文昵称"); - ]4 @9 x; Y* {! L$ _
document.sform1.chineseid.focus();
9 }+ }+ N, E! M: M' t! M% d return false;
[$ ^0 U4 R8 t4 i6 O6 u } ) U) y/ d( d5 z2 J, \% o& F% J: Q
password = document.sform1.password.value;
p3 S7 b4 t. q3 ?" f if (password == "") : h6 E! Z! K1 j ?
{ # d5 h/ ~6 v6 ], D& C3 Y6 P% ^
alert("请输入登陆密码");
' n" e3 t; B r, w' H) Z document.sform1.password.focus();
7 E* D& j b7 L/ W$ |4 l5 t& J: u Q return false;
% Y$ M+ ~3 |( A } " ~* ?& o8 c5 U# l( {, g E
password1 = document.sform1.password1.value; - h' ]7 i7 h' E/ i E
if (password>password1) ! x! X: c1 v; [. i
{
; f. J5 A9 f2 ]+ s8 A, | alert("重复密码与登陆密码不相同");
) U* Y0 H$ A# o: d6 H5 G document.sform1.password.focus();
- N. L# K0 M+ G/ E. U6 f document.sform1.password1.focus();
. l* C# z; ^% e; d/ t- F return false;) D& {2 l5 M, W& C: [: h9 A
} 6 R, T& b' c9 S6 D" y
if (password<password1) 5 C/ y, K1 o* H2 j" Y
{
( N/ F8 e& ^; ]8 M6 a# Y# e6 ~ alert("重复密码与登陆密码不相同"); 7 c$ i. X9 r5 q1 J
document.sform1.password.focus();
& {/ w1 ~; ~ n+ F; Q document.sform1.password1.focus(); + b2 |/ z7 H0 R. f
return false;
4 a2 Q3 T" ]# r$ c Y) C } 5 c% `# ^. E) \5 a9 o2 a" r4 ]
if (document.sform1.email.value == "")
* E- l4 Q; i. G, `: K {
1 q$ U W/ N8 k! }* J4 H alert("请输入您的E-MAIL地址");
$ k9 i. J. c9 L3 ]/ a9 @% U document.sform1.email.focus(); + E) V. o, y" n- ~$ C4 P5 M: r1 o
return false;
' Y/ u" Q$ h" T0 N: Y& B }
- e3 m. `1 i& T) K ' E: h5 L% _" T, W" ~" Q5 L
email=document.sform1.email.value;
( N( \4 d) N# o; u emailerr=0 / m: {1 Z! ^/ h( [/ c
for (i=0; i<email.length; i++) 5 ~- W0 ^8 b- L/ M: A1 l- O
{ ' {3 D- Y* A3 |( t8 Z
if ((email.charAt(i) == "@") & (email.length > 5)) , S! D' q2 P! Q; T1 p$ @
{
0 g2 c U3 q& W' D5 s1 |, I; h emailerr=emailerr+1 " R+ j2 L. i# n5 e5 ^2 b
}
; z# x W9 E" e2 [% R } + T6 U% O1 ^7 a6 y# a
if (emailerr != 1) . m8 J: j: @! E8 N+ m
{
2 i5 M1 D# q/ r/ i* O9 Z N/ | alert("请输入正确的E-MAIL地址"); , W; g+ j, Y$ W6 E7 s, A; J
document.sform1.email.focus();
/ [, ~. |! l2 O8 w: B0 C return false; $ F2 }: Y3 A" X3 i
} ( h1 s& I0 d4 J. I5 k" r
! q( E# F6 D7 q3 H$ g8 l
if (document.sform1.checkask.value=="")
* M( Q: Z# Z9 b" Y) I { - @/ z: }' ~. w. V# }! D% I7 t: P. @
alert("密码提示问题不能为空");
7 l3 s! w" x7 n4 y7 T. t% H! {& l document.sform1.checkask.focus();
" A) b& \+ O' [- o6 r2 g return false;
$ g7 _0 L9 N x$ l- D }
; Z0 q! W0 V: W+ k6 R H- E if (document.sform1.checkans.value=="")
8 a$ S6 e6 A+ \8 O/ M9 X { $ Y& X# r" _0 ^/ p, Z, ]+ o, b
alert("您的密码提示问题答案不能为空"); 3 f8 r/ H+ e; a; e( q
document.sform1.checkans.focus();
* y" z3 I6 C9 {+ L- m return false;
2 Z( a8 _! D$ g$ ]; W' f' e8 Y }
- D1 W3 f8 o3 e! ~9 v, I5 B1 D8 w return true;
" s. J8 D! p' H9 H& ?" G/ Q# f + r* K6 o' _7 d3 L; f4 ^
} + C$ T3 i, h( H8 U; T; r
</script> |
|