  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
这个脚本对你可能有帮助:! j! v: C! m1 B C! [
<script language="javascript">
. c; }* X. C5 e3 ^! Ffunction IsDigit(cCheck) 7 ~1 V5 P$ [6 q# c7 S
{ 2 a; S0 Y' d" S- v/ L2 t% m* z
return (('0'<=cCheck) && (cCheck<='9')); * I# @ G J+ k) I; U- ?& H: [) d
}
7 V! D) s; `2 \! b, x' q$ I % j/ V, t4 c! u
function IsAlpha(cCheck)
2 m9 @! X3 `. x: v { ' H0 f$ ?: U; s; i& a# ?
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) : i* r0 N6 X- e: H6 \
}
8 l% c0 b( S( J3 v * ~- ?; n1 @. V4 w
function IsaNull(cCheck) 3 H/ h4 t8 _+ c' q9 B* ]: K
{
2 m$ k3 |* j2 s D return(cCheck != " ") ; u: E3 [. l" d' s! u2 N& M
} / q& x6 b+ o) `. \5 ^9 B/ B
7 W- E$ u0 R% ]- @# c3 l7 ]
function checkform()
5 t# T1 S2 X2 H8 ?" `{
4 S$ `" Y6 v8 c& J& r, n ^4 j6 F id = document.sform1.id.value; 6 Z- X: X* A! Q
if (id == "") 3 a% G9 D* I( R. w) C5 D% ?. p) L
{
4 j) A2 C: y& E0 n j alert("请输入注册名"); - l+ c% u5 | U
document.sform1.id.focus(); - T& u+ H3 _& Q* v
return false; $ M6 m( D3 U2 ^' R. K4 N
}
! Q0 A3 N" D9 [4 S |) Q
* K8 F$ o2 a# y. l for (nIndex=0; nIndex<id.length; nIndex++)
: U1 k! t$ I* [ {
. g9 t( |. X+ ]9 f cCheck = id.charAt(nIndex); " ?: g* x. I S C" h2 j- s
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) _; W! u7 C" p" b7 a% }
{
) h) o( k- A! \$ p [# @8 I alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - y1 v; Y7 O5 Z" Q6 f9 i6 b
document.sform1.id.focus();
6 m# O& D3 v$ n' `+ v* \/ A1 E. W return false; $ e; f+ `$ L' f) G# F+ ]3 m" w
} ; l" O7 g" x/ E- s& Z
} ( l) ^8 Y5 X8 X: P2 s% t" t7 Q* t9 S
chineseid = document.sform1.chineseid.value;
7 T4 W+ N- e8 f5 f V if (chineseid == "") 0 I: G b( ~! s. j" `0 l0 Z
{ g6 @: H* v$ K' t
alert("请输入中文昵称");
. f; v% _1 W6 F) g- \7 R document.sform1.chineseid.focus(); % Q O( o% U: d+ f+ A+ ~& B$ [% |+ x
return false;
2 d0 M) j7 y$ V } # a* i s- K) \( W8 a
password = document.sform1.password.value;
3 I+ Z! b: z$ s" \/ G4 A5 b if (password == "")
- M4 d e+ K! O) ~; w; |9 p$ g( s {
1 m6 p! a/ ?7 @, h! D alert("请输入登陆密码");
# | R9 X; \ i" r/ U# I document.sform1.password.focus();
& g& C: E' U) U return false; , W8 p" [1 ^: ] w0 l0 u' I' [4 D3 U% ~
} % S* L$ H. ~9 X1 \! G7 g
password1 = document.sform1.password1.value;
' ?, g0 a* r' a if (password>password1)
- [% N, T1 N4 J {& g- c/ x8 ?8 X# \1 I0 z. V
alert("重复密码与登陆密码不相同"); 0 b4 S* t8 t+ v3 s, [
document.sform1.password.focus(); " w! H) D1 o" E- J$ r! _" i
document.sform1.password1.focus();
( l$ E8 J. k# K/ U3 d2 a return false;
! l ]* E: k8 l! x' }/ ? } " e9 S1 i3 p. Y* M; O; j
if (password<password1) " k4 R8 u5 j6 f6 t n% o
{
- p- X, [9 M" `) [) Q alert("重复密码与登陆密码不相同"); " J4 a) D/ H; O, l& m8 G
document.sform1.password.focus();
2 ~' K7 V$ I$ B8 H) ? document.sform1.password1.focus(); - ^* U# x2 G A) k6 P' ~% l* ^
return false;
4 P" u" v/ h+ Y# n, n }
& t7 @& y) t# ?; W* h# s! [0 @1 s4 x0 r if (document.sform1.email.value == "") 8 f/ t. f a& a3 p
{
7 l/ m0 t) n# h$ Y" Z# O, C6 S alert("请输入您的E-MAIL地址"); ( {' e9 V$ C" x) r; W& ~( I
document.sform1.email.focus(); 4 ^8 O2 e. k- D! H9 a
return false;
: b1 H" J8 _; ?. v l9 }* I }
& B' N# V/ P& u, \& \ ' @# z; F9 V3 @8 ?
email=document.sform1.email.value;
# v! p6 \4 g$ t" U( t, J emailerr=0
# `; @& O2 t2 ]9 b6 Q9 `& h0 j for (i=0; i<email.length; i++) 5 P5 ]8 H! m0 L4 B+ n9 v- x
{ 0 [2 y/ ~5 [' M; f& u; T
if ((email.charAt(i) == "@") & (email.length > 5)) 3 \+ H0 L8 ~+ M3 o: {
{
( S8 p1 M" Y/ s5 E, K1 d emailerr=emailerr+1 5 S! _5 l0 a+ F/ \2 P& l
}
0 y9 E! f+ N& d/ y }
0 U1 `- K1 y5 y' V- Q% s* U" f if (emailerr != 1) 9 V$ K! t+ J1 \
{ : _: \4 L! I/ D6 s7 L1 w1 M/ g
alert("请输入正确的E-MAIL地址"); - ] T" k& S( P7 V, W
document.sform1.email.focus();
+ k* s; u. S/ m% f) n* A M return false; 4 \" F p! p, H7 h( i+ Z% {9 P
} 2 h9 Z# f6 Q+ a2 F% P7 W2 H! g
; q# ] n7 i: c+ c; Y) a if (document.sform1.checkask.value=="") 8 D0 O- J( f+ F
{
5 K: `" t6 B" N$ e alert("密码提示问题不能为空");
! {+ h4 F8 z& c, T: A document.sform1.checkask.focus();
$ m( l: X. N* r2 X. [3 J return false; 9 `9 Q" Q" S* }- \9 H
} ! j+ R% m+ Y* ~
if (document.sform1.checkans.value=="")
6 }9 B" ]- L! }' a- \6 l& K { 7 z6 m1 j1 \5 m7 c. m
alert("您的密码提示问题答案不能为空");
) s1 g+ N5 ~) F9 W document.sform1.checkans.focus();
1 W( ?9 {6 R1 l( p return false; b7 I' T. _" ~1 Y( E" {
}
( d: B8 V; J: X8 n( e return true; : F! y; C% F' S& I6 `2 \
9 v8 i$ l- J/ }+ a
} 9 \* h, I% V& i& ~: Y
</script> |
|