|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:
, R5 V0 a+ h, _9 f3 T<script language="javascript">
5 {/ j1 W+ r O7 G, E6 cfunction IsDigit(cCheck) 5 E) y: A. M1 S; [
{
) M' l) `9 y) H' ~% ] return (('0'<=cCheck) && (cCheck<='9'));
+ v/ r7 v8 @ q! S( M+ b } U$ r7 w8 X: T% B$ C& q- s
; A( K6 E, @ D3 ?2 ?$ c& Yfunction IsAlpha(cCheck) I8 E! R2 [! c- d
{ 9 Z- c( C' @$ Q/ I, @: w E7 l- @
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ( E! R5 y4 n2 _) d9 p, }" p9 {
}
! c* Y! V1 @& U# W$ C# n: h0 N / V# q1 c& F2 ^6 i/ @
function IsaNull(cCheck) 3 B+ q- D$ R, G9 g) G
{
$ Q( k4 J, N. n3 |$ ^3 S5 b( c: b return(cCheck != " ") ; o4 O3 }; d, Q2 f- L: M% Y
}
0 W& o$ h1 }% r' k9 B% |6 a4 |/ c( m / C/ W; u/ a. }$ E2 j
function checkform()
# T! k; d& j) L) a; Z{
: n. @" [/ W: n id = document.sform1.id.value; 4 Z0 K! F* R; a" H P
if (id == "") , s4 a. E+ j) N. ^9 T
{
7 l" h! i6 L3 L1 T9 h alert("请输入注册名"); 2 @3 E% G6 a/ Q4 q5 }
document.sform1.id.focus();
3 q! X& u- u C+ o* T5 X% a return false;
' X. Y, Z7 L4 G3 T T: o }
2 M+ X: s7 M% |$ J/ L' [ : ~# n) Q) {0 ]% o
for (nIndex=0; nIndex<id.length; nIndex++) 9 f1 E7 {& i+ r
{ ! y3 P! K# }0 g3 a: l
cCheck = id.charAt(nIndex);
, v. w% l* M& ?8 X% E if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 1 n9 R4 D8 `2 x) A) y
{ 2 Z: X$ G' T `- y) Z' M) {
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
7 I ]; ~; f$ n; I document.sform1.id.focus();
& p: c U$ h5 v+ r" U. X return false; # f# e+ h# f% @+ j/ s6 r, h
}
+ U; R' S( w7 N7 O8 K& U5 S9 @* L }
. w' M% z3 x" r9 z9 l% W chineseid = document.sform1.chineseid.value; 5 Z4 ~. p+ ^& P+ }' ]
if (chineseid == "") 5 u; v1 O+ b6 l9 t
{ ' g+ y1 `1 e) Z7 p6 K6 [) Q
alert("请输入中文昵称");
' p" b; E9 P$ h3 Z7 \) z1 L document.sform1.chineseid.focus(); - R H) g: B# b$ P1 C
return false; - g* |( r4 U0 z$ Y) a
} * J3 i7 X. @7 W/ |
password = document.sform1.password.value;
_! N- `) ]5 s9 X if (password == "")
' T; M, ~" i9 q( v* O! i {
/ H& e) K }2 M" G/ O alert("请输入登陆密码"); 3 q2 b0 K! X Z% y1 W e
document.sform1.password.focus(); " v& I# r) ?4 y
return false;
" [0 z# V. u1 f2 S3 m } & J k' p1 _- Q1 e$ ], r
password1 = document.sform1.password1.value; 0 j, q) V3 m- L& g- H2 X6 a7 x8 p
if (password>password1) 2 L! i) V- L0 g0 {( |
{8 t: V% R7 s& Y3 i' L6 ?1 q: X
alert("重复密码与登陆密码不相同");
# k Q' N" X' J! u document.sform1.password.focus();
* ~! p) d N! ~9 e document.sform1.password1.focus();
3 y+ h$ f% [# r; y* H0 ]9 q: b return false;6 m0 ~/ i1 K/ _
} ) m; b3 ]3 ]3 `$ G7 @# V) q" _
if (password<password1) + M+ b) ^1 i- E
{
7 P# I! Y' }) M/ A7 n6 t; c alert("重复密码与登陆密码不相同");
+ h+ x1 ?+ \/ m; ?: f7 v document.sform1.password.focus(); 6 }0 u: |8 l; T
document.sform1.password1.focus();
9 }2 a+ P4 ^9 a. {* H1 E return false;/ \; Q$ h, e4 u9 t
}
; O7 Z1 t. E+ l" a if (document.sform1.email.value == "") / _9 m" X. z U% z
{ 4 `9 X. a+ O/ O( o; [
alert("请输入您的E-MAIL地址"); ; W, A# p3 t: f7 ?* A' V) F7 y
document.sform1.email.focus();
: j9 s# Y- C( @- R' | return false; * @6 e+ ~9 F( L0 Y3 s
} 0 b; c" u) G/ I
7 {1 k. F6 r9 l! c* _; t y
email=document.sform1.email.value; " R: w( A; K* @$ W
emailerr=0
& B0 @& K H1 v for (i=0; i<email.length; i++)
1 _' u- _* x, L# X1 J3 K4 P {
[0 j6 @; G9 b* [; k, E6 P: D if ((email.charAt(i) == "@") & (email.length > 5))
( C& g$ l6 g3 N v$ y3 L& G+ I) { {
& K* s! s7 S/ ]* ]$ b emailerr=emailerr+1 * }5 I+ |. K+ `* o2 \: {
} $ o+ k/ i y& K! y1 U* \
}
8 D- _+ Z |* g1 { if (emailerr != 1)
) e+ @3 R5 e& d) ?0 m. i# r+ t) r { 5 E! M7 F' k5 Z% O, {
alert("请输入正确的E-MAIL地址");
* O# W" s7 `- u+ @* P' y$ p+ ^' } document.sform1.email.focus(); / b+ E) r2 I, {
return false;
; {* |: ]; }7 j# G } ! {9 P! y5 [% I, n$ a: s6 E, z' b7 |
3 s& q+ H! Y% ?+ e- E if (document.sform1.checkask.value=="") U; _% J) b+ s$ I5 }: h/ D" b
{
( n8 r' K/ y7 ~* F alert("密码提示问题不能为空"); Z2 t6 I$ p( c# t
document.sform1.checkask.focus();
' z5 N, w: ]; Z return false;
' w& l1 t+ X+ E w6 ~: Y8 h f/ L9 w } - _1 p& n4 v. \( T" Y2 c) I# ?
if (document.sform1.checkans.value=="")
, J7 G) |% i1 }+ Z3 l1 X4 ` { # Q) J8 t' ?7 i/ I+ f
alert("您的密码提示问题答案不能为空"); ! N! I3 W2 e, v8 R; u2 W
document.sform1.checkans.focus();
9 G2 P+ P4 Q* S6 A return false;
; [8 d- b+ ~* P% C }
/ H% T; v( [4 g D* K% \8 U return true;
5 A3 f+ R+ G; p6 z/ j7 H
& M0 X% ^& _! U0 g& `# ~}
R; S8 H+ R8 q2 q</script> |
|