|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:
. Q" w. o4 E8 r1 D. {/ ~" _<script language="javascript">
9 b% F6 q1 V! B' L% Q3 }- Zfunction IsDigit(cCheck) 0 a! K5 @# A. v. l2 I
{ 0 ?" v! l/ Z6 L. Y) p- Q
return (('0'<=cCheck) && (cCheck<='9')); - y! c. v# u; `' f9 L. v4 H
} . U- [7 `& G2 ]9 C
4 w( T" ?# u B$ n8 Q ~$ a$ Dfunction IsAlpha(cCheck)
# L9 W% ^( ~0 i( W { . I$ w) ~1 t$ h+ [
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) $ b. K: p3 P: }/ {/ E! H4 H% @
} & d5 v! F; g. F; c! Q1 c! M
* Y) x' q- g6 S7 H6 yfunction IsaNull(cCheck) 4 d: x1 @' j k! @4 S( h5 z
{
$ |+ `' |( x6 r0 _! r return(cCheck != " ")
9 E% g( w9 d9 B+ T- A }
+ F- C6 r2 D9 K* p8 j3 i
% j1 z4 k' _2 L4 D' v+ i2 ?6 ofunction checkform()
7 f6 K; c: { P2 D' a, o6 K6 k; A{
! v: E3 H, ^4 u id = document.sform1.id.value;
8 y+ g' Q$ Z3 m( W' t0 V if (id == "")
1 ?/ n5 c8 n6 O5 O0 m { [+ e7 Y: S* K- c8 h
alert("请输入注册名");
- N4 L; v8 U8 a6 |0 B5 s5 u ~ document.sform1.id.focus();
, q9 L- Z# I/ W4 v return false;
& \- \: }5 H+ b, X& g! k }
2 V9 j) B' g3 O7 n2 |" x% v 1 a9 @4 `1 Q9 C6 ^1 p6 f
for (nIndex=0; nIndex<id.length; nIndex++) # j: U6 N; I4 E
{ + G5 V# U5 i( y( b. |8 Y
cCheck = id.charAt(nIndex); ) L$ D% V* }( J
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 6 ^! \% ^ W6 G2 G3 P) { ^
{ % Y# a/ D9 O% r: h4 x
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
7 _8 e* e- z& q, H document.sform1.id.focus(); 5 D; N2 q- C8 s
return false; 1 u [5 C" _; A7 n+ X; n
} 9 q, W. }7 h" B& u
} ) `5 E& P1 {" {6 |0 x# T/ c# L$ y
chineseid = document.sform1.chineseid.value; ! h2 I" L0 L; {: y3 Y+ C
if (chineseid == "")
' ~" w. D) m$ S) w { X9 O# j# s; l J: {; X8 ]
alert("请输入中文昵称"); ; R: ~. ]" \% p
document.sform1.chineseid.focus(); % {5 u! F% K0 d* N& H; J- l
return false;
& \0 s1 M9 ]4 u( {2 S" z Q4 \2 C' I }
! P( q4 x/ ~6 ^$ X6 x password = document.sform1.password.value; 0 m/ U. t0 @: T! H
if (password == "") - ], o% B& t+ B+ {
{ _ }3 |9 ~: ~
alert("请输入登陆密码");
4 d& {" X' I/ a; o- ?1 F# ?/ N document.sform1.password.focus(); & W5 L& h$ C V; y" x
return false;
2 f f" ?( h2 f3 [% ]& M8 g }
; j! q' c; E" r& ~5 ~4 N password1 = document.sform1.password1.value;
' R; A& I/ {% i2 b if (password>password1) - X* g( C6 n% u+ [. Q* |
{
" U" r/ o: J& M" G alert("重复密码与登陆密码不相同");
( K" G% s/ ]+ ]7 B document.sform1.password.focus();
. z2 q/ S0 ?, t" b document.sform1.password1.focus();
4 s" O- H9 |/ J; N- D* K/ b9 N return false;4 x1 x) O5 {/ d& x
} , x! U/ e% r7 X
if (password<password1)
( A2 ]- n& |$ f {
5 c. S1 y& j }. W alert("重复密码与登陆密码不相同");
7 Q1 h- z5 R% a1 [# z2 B document.sform1.password.focus(); ' J( o6 c# P9 G f! v6 j+ U. M
document.sform1.password1.focus();
$ f5 f# d. v9 z, v7 [4 } return false;
4 \: L/ X* }/ C7 K9 \ } * }5 }6 D+ [2 [3 b$ K4 c
if (document.sform1.email.value == "") / g- A3 g8 u6 X, Y
{
! D6 ?# n# x: \# c9 K# s s3 i$ s alert("请输入您的E-MAIL地址"); . ~7 s. G) m, {: G7 B
document.sform1.email.focus();
7 S9 p& ~- t0 Q+ d0 P# L return false; 7 F! m" U! B8 y7 L
} + O7 |2 n( N& Q2 h' J
7 L+ _ k" f! C: z
email=document.sform1.email.value; & @& G2 V, H2 W* P1 u. F4 h
emailerr=0
9 e( P; H. D8 _* K for (i=0; i<email.length; i++) / t- r& j, T) C! c& o/ `) [
{ 8 h9 ~" a( Y# x( a1 Y
if ((email.charAt(i) == "@") & (email.length > 5))
/ J% Q# Q' S/ \- o {
, _% [8 x+ n5 M8 l. i. p; U0 g: t emailerr=emailerr+1 % M3 c% u) I/ b. B8 i
}
8 F0 T6 l5 D) U* E* ^: o7 e0 T$ @9 H$ }. w } 4 X0 V4 e) l+ c6 c: u
if (emailerr != 1) " {0 w7 M; X# v9 j; |
{
: c# f7 Z" {& D7 V( z alert("请输入正确的E-MAIL地址"); 4 G/ ^) t* z4 E: \7 {1 ]# P6 M
document.sform1.email.focus(); 0 f* D A: C* A& d! w
return false; : }6 }+ n4 d; {3 `% L0 w
}
. u j% z" \% Y2 n# ~
2 i, S) ~" W2 e' j6 O; y if (document.sform1.checkask.value=="") " H6 [3 P9 \% S, G
{ + |6 z% D q1 ~0 x6 C
alert("密码提示问题不能为空");
+ W* r2 u# N+ B) S- b: y document.sform1.checkask.focus(); % D0 ?/ e: @+ |! [( t
return false; 8 B% ?$ n' M6 G+ U
} 3 [/ c \8 D0 r) g0 q; H- A1 ]' K
if (document.sform1.checkans.value=="")
" f4 J9 }- A/ @: b8 Z( a# E) t0 ~# ] { . H" _; ]! @! D" p* S+ A
alert("您的密码提示问题答案不能为空"); 9 E+ O* Y `+ k5 D: S
document.sform1.checkans.focus();
3 [/ k# d. s" ^$ H return false;
; i8 h r% Q4 [& H2 H }- h) b; |( m0 c* {" s5 f6 a
return true; 9 c! ]/ G5 B. B+ W* ^
+ @. @; @" g% K
} / f- Q. x+ E. k6 p7 g9 ~
</script> |
|