|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:7 n5 M6 |% P6 |( Q
<script language="javascript"> ' z- f/ b! M7 S2 M# I ~
function IsDigit(cCheck)
Y' s6 p* H5 p6 u/ R' x { ; b( ]! ?. c7 n( |
return (('0'<=cCheck) && (cCheck<='9'));
- w/ H5 g: X* C } 8 J! N9 X$ E& I' \! S( n8 Q
B- ^" @2 |) _8 Qfunction IsAlpha(cCheck) - K& W+ z9 \; R+ l+ Z+ U7 Q, a
{
; @& c* \) E! W return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" `* e( q) D' \8 ~ }
" ?9 W u( A3 s4 G k! I+ Y * B: Q" F$ \+ l! n L6 I: ^
function IsaNull(cCheck)
; F, S0 D" L$ C1 p# w6 h { 8 n- |0 c* a# n! T2 l4 o$ [1 C, h
return(cCheck != " ") $ B4 v1 d8 Z3 ^
} 9 Y) O7 q) C& L! E z. p
4 x2 D$ j! ]. P" m3 n1 }1 ?! efunction checkform()
s' ]$ O- y! m! E' _{ ' K4 s" d% T% i& E
id = document.sform1.id.value; * Z8 p% o4 b, H9 @3 }4 J
if (id == "") , i0 O3 Y$ k- d& S
{ 6 p0 C5 j: _4 R% o8 I5 g
alert("请输入注册名");
' [: D" r$ U* K* c3 c& ^ document.sform1.id.focus(); / _. ~1 ^8 Y6 D/ w1 ?
return false;
. t& J7 i+ p% @* d* A/ S7 k7 m: A }
1 ~$ |+ J$ F) Q
1 J. c* G1 T D for (nIndex=0; nIndex<id.length; nIndex++)
- y2 e$ q/ q* r& I8 t9 z {
" T& w- H+ C0 H; F/ _: e- B/ F cCheck = id.charAt(nIndex); 9 N; E8 b* m) x9 ?
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) , P' ^* v, n/ r7 ~2 V
{
V5 S2 c7 Z* w9 {! t alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 0 G4 ]7 s9 o' t! y8 A& K
document.sform1.id.focus(); x0 t& S0 q; X" L' B7 x* A
return false; 3 m% E' `' w, q* }
} ( ^% ~# i$ q, E! ~9 g
} ! v/ @! I. a2 s! P
chineseid = document.sform1.chineseid.value; 0 s! v0 ]: \* g8 I* Y
if (chineseid == "") # o# }9 r% s1 t6 E! Q |
{ ; k' `: E7 }1 i! H& \
alert("请输入中文昵称"); J9 k) Q6 u+ y7 I, ]
document.sform1.chineseid.focus(); 9 o3 S7 M3 U2 C+ C
return false;
3 W" ~& t8 ~- s8 J) n6 l( {8 b }
! W7 {; Z3 {# ^" q3 q password = document.sform1.password.value; $ Z/ w k$ l1 H% s( E
if (password == "") ( s! G0 V! d3 \- ~) o# n* z8 Y
{
# F' p1 u. a1 G! J. v% N+ i alert("请输入登陆密码"); & v v; j* E6 ?) C2 u
document.sform1.password.focus();
0 }5 x/ F0 Z1 j+ b. O w3 m+ g return false;
8 y7 L* `8 Z N$ d1 N4 w' |) e }
! |& D/ d. j f9 ]0 O! { password1 = document.sform1.password1.value; - \; ~" j9 d) [' D8 J
if (password>password1) 6 C$ u' M! H0 b- F+ d; X# u) @
{! D$ ^7 ^7 t( s y! ?
alert("重复密码与登陆密码不相同");
6 t* z6 L- Y' @: W document.sform1.password.focus();
% I4 d4 t! k& x; [: s% K" H document.sform1.password1.focus(); : K" ^* S( o9 Y" {$ i/ J6 z* D R+ X. r
return false;
6 V/ q' v ^* W0 Q: B8 c } 6 k2 Q* W1 b/ @0 z7 Y. j" T& E
if (password<password1)
$ @% C- K1 R6 N3 m t2 q {. I6 s' w! \0 m/ i; o- b, N* Q5 t
alert("重复密码与登陆密码不相同"); " r2 v& d8 O* g
document.sform1.password.focus();
# p2 W" {& d7 A; G5 V$ P" R document.sform1.password1.focus();
! T; j- a, N9 L- ]$ |* W( x3 e return false;
: j& i# ?% W! X1 ~ I. f# ? }
( t6 i% y$ S4 B/ e8 p. S3 X9 P. T if (document.sform1.email.value == "")
8 A! x c' L+ U$ [) O* U. O {
! Q& w: B2 Y) O6 j$ y alert("请输入您的E-MAIL地址"); 8 o r% u* c( s+ }' I0 B l P
document.sform1.email.focus();
7 l4 n# Z/ ] A* G# K; d return false;
7 x2 z1 G/ t" ~ } 1 q- i: M( ^5 y- |1 X7 g( x Y
1 R; l. u: E6 U3 Y
email=document.sform1.email.value; 7 @. J7 g* O3 p4 b. v1 }
emailerr=0 8 p! W @# f/ R3 a0 [
for (i=0; i<email.length; i++)
! u3 f* M3 o0 V* G) H* } {
! I; e1 m# N) J; d7 F" ?' g if ((email.charAt(i) == "@") & (email.length > 5))
% U: w. H, v3 r- i {
& K& N/ M! h5 v# R. u5 g emailerr=emailerr+1
- J6 x9 U( i5 h: A' V+ L }
+ a Z/ \" W) I# B& M* l- D K } 6 D3 u: z3 N# g6 P& r) q x2 F6 ?
if (emailerr != 1) 2 E3 A- p5 G1 Y9 _; M& h1 u
{
9 u, f/ E- \# R5 G* P; {) N alert("请输入正确的E-MAIL地址");
, R( y7 [* I' a document.sform1.email.focus(); ' p5 q) x; ]( d% W7 y% u# t+ e
return false;
1 `' X& k( F! _+ A \( G1 w }
# I1 Z# Z. U; I5 X , \& A4 ^' G- L& \' ]0 I0 |$ I
if (document.sform1.checkask.value=="")
: @( R) y7 ?: P0 Y5 I2 E# Q {
1 D2 l* h5 x. o) [% F alert("密码提示问题不能为空"); 8 u/ v- k. Q: `
document.sform1.checkask.focus();
' I1 n' q3 Z# s: n return false; 7 a& {& l' O, [+ h5 ?" h1 l
}
2 i7 O: p+ K9 `& n( ?* w Z* N: P if (document.sform1.checkans.value=="") X/ d0 a- Q6 K9 E$ l$ P& ]
{ 7 t& G0 f; \7 X( N7 a* |" r+ {) K
alert("您的密码提示问题答案不能为空");
1 C6 k6 l6 n; W: ^ document.sform1.checkans.focus();
- Z+ q. A7 s6 s, j$ |. S* u return false;
1 L' L( n) ? S7 `/ F' u$ f! H0 f0 Q }$ l, o" m5 p. ^9 q9 o2 l2 F. w/ B: }
return true;
% M; M; P$ e+ Y- n( t
) r+ h- E+ M5 w7 a8 f; A0 j4 q3 e1 u} # X2 E" s) B! @9 w
</script> |
|