|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14341
- 金币
- 2456
- 威望
- 1647
- 贡献
- 1404
|
这个脚本对你可能有帮助:
, x8 f- Q4 D I; X* r, \" z<script language="javascript">
# {. O+ n; I# Q. mfunction IsDigit(cCheck) ! t3 O# p$ l# D/ E4 P1 [$ @
{
3 |3 a7 R7 h5 M; B( r2 Y8 @ return (('0'<=cCheck) && (cCheck<='9')); " ]4 c" U# [) r1 X
}
( i$ `1 f" l( n% j! u
8 M/ F# T. E C# R: z+ Ffunction IsAlpha(cCheck)
7 \6 t9 _" T" A; a1 _ {
) ]# f6 I" n/ W1 {4 b; j. m return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
8 L. {, M4 a6 [% } }
3 `% l9 x; s- Y" E- R
: `) {5 I) Z8 P& [5 T& mfunction IsaNull(cCheck) + j$ q% `) s& t5 z
{
7 G _3 O6 b B+ C0 D return(cCheck != " ") K; T) n+ T& n, W5 d$ s* ^
} * E. T9 M% _7 T+ V+ a; C
1 |# X) l- s# {7 H
function checkform() 1 ]* a' W2 Q* L! _: V3 N) i
{
( g5 K7 m( j7 L1 h7 Y id = document.sform1.id.value;
0 b0 I8 b+ j) Z+ u7 {! ] if (id == "")
0 r3 `" b/ \$ h/ ^* E {
* @0 V+ {( _0 i/ u8 v1 { alert("请输入注册名"); % X5 M* Q( O+ v& Y/ P6 ], Z7 j
document.sform1.id.focus();
9 F; F( k- Z6 y& b8 E/ t4 X return false;
2 s2 ]- u; o0 q; R } % [! j+ k; t$ z1 W* A' J
( N6 x5 P3 H; E1 M7 e3 _
for (nIndex=0; nIndex<id.length; nIndex++) 0 Z- I: [+ I- q4 `" X( S
{ * i$ P H8 S- U6 Y0 @* z( |
cCheck = id.charAt(nIndex);
" a2 \7 {9 B) n$ Y- I6 s3 I if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) $ J* {" _" l) z; C
{ * |9 f; Q7 x/ s4 ^, x2 ]* n" z( B
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
( d D" D' l7 ?% S' W document.sform1.id.focus(); 0 @3 c# B6 \7 D$ b
return false; ; K. K' e$ A1 c3 G P, e: Y
} 3 X7 I( a6 `/ F* j* e4 R
}
: I* ]4 P$ ?) W; Z0 `! G chineseid = document.sform1.chineseid.value;
" }3 g+ i2 t1 t! a* [! p3 q if (chineseid == "")
# p- ?7 V5 O+ @3 A6 V! [* y1 @9 j) S+ e8 K { + s) {0 q+ d7 {+ n8 H# o W, G
alert("请输入中文昵称"); & e8 R5 o; ]7 k6 o& J) S
document.sform1.chineseid.focus();
1 @5 I6 ?5 ^" n return false;
7 g2 n! ^/ o [! e } 9 o( P0 ^8 w* v4 X' ?, h
password = document.sform1.password.value;
/ r# ~' _; w( \- l5 Y if (password == "") 0 w' ~( G z' S! i3 }
{
+ k2 y' ~8 r1 Z! W. P1 M alert("请输入登陆密码");
' y$ w' j! f2 r( E, O9 j document.sform1.password.focus();
d* `+ s- p/ ^( t9 [; ] return false;
, W7 d: x' t. Z) T% Y }
3 E% n. L; W6 n( z$ q9 Z password1 = document.sform1.password1.value; 5 k: s& f: d% k7 B
if (password>password1) 6 V2 s9 a1 v& w- I7 F
{
; \4 @' D0 f) [5 ] alert("重复密码与登陆密码不相同"); ; i9 ^2 x! K( G6 v
document.sform1.password.focus();
9 a. ^0 m1 ?3 K6 y: d/ J. a# |, U8 V document.sform1.password1.focus();
4 {1 u5 \* d3 {5 l" T' I return false;# {' a+ ^4 Q6 R( D- h4 C: z
} + ?. ?7 x9 X% ~4 N
if (password<password1)
5 V9 b; |4 g% C) H: ] {0 u1 F- r1 ` e/ b5 O- ~/ ~0 |# @
alert("重复密码与登陆密码不相同"); * S, |& |3 o& I( ^- i1 F
document.sform1.password.focus();
9 ^0 l# O# H1 [& N document.sform1.password1.focus();
7 `8 ~1 I& q9 }! V, r return false;
% a0 o* e7 p" {# _, R# K }
$ \8 {9 p* _( p( t& { if (document.sform1.email.value == "")
% M/ i8 f5 {1 Q9 A. W+ z- Z {
* p; v& n* L; J; ~ y3 t alert("请输入您的E-MAIL地址"); - u+ G0 X8 d# ?( {& K
document.sform1.email.focus(); 6 I' l/ g, S7 {$ p- s
return false; 2 e( \7 J* F# ~
}
' b. C& q% o+ ]2 g F# F: K' i . T; ]) f4 M8 j8 e% P9 j
email=document.sform1.email.value;
% C! \9 V. M. A# t- w7 G: t emailerr=0 ' _7 t3 Q1 q: L4 n, M# Z$ R
for (i=0; i<email.length; i++)
1 c+ ?( u3 d8 O! _ { & d# g# ^, g2 v d$ g) O5 ^7 Z
if ((email.charAt(i) == "@") & (email.length > 5)) 3 G+ f6 q# x0 Q" t, {8 g
{
* U+ G# I& U8 S* _: ?0 s) L emailerr=emailerr+1 ; O5 \9 i! v- k: K
}
9 Y" D% f9 S# v* V. N } 7 s" R! {' Z: ~0 W3 B
if (emailerr != 1)
% T: q# h. [ S a- ^3 V- o7 B: w { ' N% Y' z3 g+ c# S1 C9 a
alert("请输入正确的E-MAIL地址"); ' b4 W( e8 R3 \" a& Q8 B3 ^8 `+ c
document.sform1.email.focus(); & R5 R \. O1 }
return false;
( k- T# e9 e) U$ z, B7 ^% ] }
# B1 \9 g5 y0 `! B
; c& @! E4 o4 B7 f$ D: Q if (document.sform1.checkask.value=="") % f" ~" U) _$ F! s
{ 6 J8 p) `5 W1 m1 D( D# D$ q9 P7 s C
alert("密码提示问题不能为空");
* z% X" B2 K6 S& p$ \ document.sform1.checkask.focus(); 6 C7 ?; U; E1 Q; L
return false;
8 m; K' V8 C, V! R. p' s }
c; b; w/ p3 _# D9 y& D* g# Z' u if (document.sform1.checkans.value=="") / A- J: \' M8 r1 ]( x! d0 J
{
, ?9 H2 o- k* m9 \ alert("您的密码提示问题答案不能为空");
0 s, H! L! f Y; a9 R* ] document.sform1.checkans.focus(); / z8 [ C( O% o R, C# W
return false; . D! h" S: N$ S+ K. b( [9 [
}. [7 h1 y0 w) C) B5 Y6 R0 a A
return true;
* Q3 y( e* m, M, {$ v6 @; ]
8 a4 `+ K! G6 u) z3 R" [" V. s} * _" P9 I( I! ]- [: E! r' C
</script> |
|