|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
这个脚本对你可能有帮助:
7 e4 z4 ^, r2 w" g: ?<script language="javascript">
0 D1 K! ]& C, ^" |function IsDigit(cCheck)
/ _7 V: ]* U( `# H' A {
4 U( ~3 i0 Y3 B6 _ return (('0'<=cCheck) && (cCheck<='9')); 2 W; w" o2 D8 a/ v: [
}
, W4 M+ V8 o# M. N: |
: @6 T, N! U) F+ V' v8 Ffunction IsAlpha(cCheck)
4 g6 l A) z+ M# U { 2 A5 Q0 F8 u# i% O" D
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . M: K! ^) t5 O. f
}
! H1 ~+ ~7 ~. H3 w& M1 D3 A$ ~9 V
0 Y7 ~; m" T" w) ~' J' vfunction IsaNull(cCheck)
/ D4 ]" m ~+ q$ d. V9 q) b- z7 y% o7 x {
^9 K% \# g9 N- p% H& Z+ I return(cCheck != " ")
R& y1 a' d6 {2 K$ u8 |; ^) \ }
2 G6 m! F2 l! m+ u7 q, `; N ; M' K k9 r3 r. @7 f5 g
function checkform() 1 B6 A' K5 X( \
{ 5 ^/ W8 m+ B& P
id = document.sform1.id.value; : s. e1 y, B5 K
if (id == "") $ g& D' V1 c- V6 l" V N! U$ t
{ $ a+ u+ j% y$ @% f* w5 N
alert("请输入注册名"); O/ o, k$ w1 o0 n% r) s0 E
document.sform1.id.focus(); # H* r- [0 h5 i, |
return false; ' [, g2 s, F) G: {; m! ?7 k/ g. X
}
& ^& r+ ~9 I2 l3 W . o( V6 Z/ Q$ W
for (nIndex=0; nIndex<id.length; nIndex++) }+ e' P. e4 Z2 J6 i
{
% C7 O- u, s a7 p. z- m cCheck = id.charAt(nIndex);
# z b7 A% ^0 Q3 L2 ` if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 8 R" {% A" p) s& L! F
{ ; D' I/ |2 ~& l6 D4 o4 _
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); % S9 B- k: a. x" i7 Z# o' a' F) e E
document.sform1.id.focus(); ) m. w% {$ Q+ O0 [
return false; . p4 Z! n' U9 u0 t& C# n5 c0 H
} 0 g8 S9 @' F0 L; {; b
}
' {; @1 O/ ?1 z( U& } U$ m4 Q chineseid = document.sform1.chineseid.value;
' ~& M) q- x# }7 S" c+ p0 \ if (chineseid == "")
% _4 k* ~% ~1 P. X2 u {
3 s( ^( _& T+ W; o alert("请输入中文昵称");
7 Q) T) m# o. A; `$ k+ e' S document.sform1.chineseid.focus(); ! o2 H& Q! R" L, z
return false;
3 e7 V/ q% n6 S) g }
+ `" D0 b9 \$ F* q( f8 L+ W password = document.sform1.password.value; 7 _- ]1 w! f7 r4 p$ Z
if (password == "") $ R$ ^' D" k0 ^* a0 _! w ]
{
+ D: t `3 R6 d( x+ d% q8 V alert("请输入登陆密码"); 5 z y4 k6 e0 `* H7 e8 @, E: r
document.sform1.password.focus(); " u/ R9 l# Q1 W
return false; 0 V6 y# V4 }# h6 Q# D
} , l# B& }, s( S: v
password1 = document.sform1.password1.value; 8 l+ T$ w- g) T: N9 y" j
if (password>password1) ) i6 @8 W: E9 X6 I
{! W9 x" r& ^% L
alert("重复密码与登陆密码不相同");
) g0 e+ ~; U4 ]3 Q! S/ j document.sform1.password.focus(); 9 G9 `7 e2 g5 Z0 {/ Y
document.sform1.password1.focus(); : c7 [' ]' |/ P+ h" O
return false;
8 M7 P2 E# _" m5 B } 2 L1 E- L( k/ X) m! d
if (password<password1)
8 v6 e7 ?( ^5 G. G/ z5 V. v {
' F/ o1 ~$ i/ i- S5 ^" j alert("重复密码与登陆密码不相同");
/ Q6 ?2 J/ ]; G9 K7 x+ B document.sform1.password.focus(); 7 @1 }1 R" A. c( `- ^, D9 q
document.sform1.password1.focus();
7 h4 K9 o( B; a2 ]3 n return false;
8 \- \3 m2 M' C4 @' m } 5 Y3 z8 ]: A7 J6 V
if (document.sform1.email.value == "")
5 b* r- m; b8 P1 V5 ]+ C { * J5 e5 g2 l8 U ^ p9 A/ p2 T$ i- O
alert("请输入您的E-MAIL地址"); - c4 E# b8 p' @# r
document.sform1.email.focus(); 4 N6 P, Y/ h+ d; P) I
return false;
0 w) J5 a& Q2 v8 t3 b% Z } ) G9 L2 Z" i5 ]% W' Y4 @
q. Q5 ]- y$ w* Z) s6 y
email=document.sform1.email.value; 8 i* Q! L0 g) v5 l' \( W) H! U* c. G3 d
emailerr=0
9 o6 P" R2 C4 ]" k1 \) a* t# _" S5 \ for (i=0; i<email.length; i++) : O2 G9 L3 _. X! s/ ?- |
{ / @9 Y. a6 D4 V4 v
if ((email.charAt(i) == "@") & (email.length > 5))
[; T1 r3 e4 v9 @2 g" S {
& v+ p1 }5 J5 y9 ~6 H emailerr=emailerr+1
- T6 m( ~0 n! t3 P, ^( t } % y$ U& K1 d0 Q8 _
}
& ^9 F$ ]# e( v if (emailerr != 1) 1 w$ g9 `% ]) R, g- b. B
{ 2 q8 Z+ Z' }" L# P$ U \! }
alert("请输入正确的E-MAIL地址"); 5 W9 C& {, i- W
document.sform1.email.focus(); ! x h) [2 c+ B. w
return false; 9 v+ I8 i% p1 f7 ?' \6 ^) l
}
" s4 i& N' B) a3 l/ K . J# |7 t) y0 i& ~. L0 O
if (document.sform1.checkask.value=="")
$ q. k1 Q; r8 ^4 l4 k- C { ' t5 p* g! t/ f
alert("密码提示问题不能为空"); + Z% _+ o* b5 b4 U3 V' Y7 _
document.sform1.checkask.focus(); # v: s0 ~: P/ b
return false; / @0 t9 U, y$ i4 O4 ?& C
} , b# m0 `4 Q9 U5 Z
if (document.sform1.checkans.value=="")
5 H/ u* d+ u/ F6 T+ D9 H {
" }4 s/ S* e2 X$ G A& I alert("您的密码提示问题答案不能为空");
g1 n$ j: L# e1 F) S2 i7 R document.sform1.checkans.focus(); * g. I( ~; d& W: K9 Z' g
return false; " \; o$ i9 y$ d
}
/ H' x3 D% ~$ j4 Y6 t( d! e1 y return true; : j2 C2 f4 e" M. r
% u" q5 s; D( ~$ d; o} / y2 p, X2 y$ Q5 L+ \- A
</script> |
|