  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
这个脚本对你可能有帮助:+ M& ^4 x9 g9 S9 D7 b
<script language="javascript">
9 K" b$ J8 Y% v% o3 @. O/ p. s4 lfunction IsDigit(cCheck)
& x0 ]) O% P5 b8 Z e" o2 U( ~" w {
* s- N& m+ M- ]4 a return (('0'<=cCheck) && (cCheck<='9')); ! F2 G( i) p! \" s
}
+ c5 _2 Q- ?- V! n
/ u$ i6 M% P7 F7 efunction IsAlpha(cCheck) 6 m( n) O: j+ V* Z& G
{ * `3 Z! [/ S) O+ h0 _7 \, Y
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
& q5 o3 V# b, E) a$ \, Z' A! \ }
6 i5 o: U$ N y G' ~7 l, C& n1 s, [
$ [$ L9 f- n. a! k! M. bfunction IsaNull(cCheck)
& K, w! Y' v; B( c B! V, |( q: v {
& l: n, w6 [4 i& v return(cCheck != " ")
& b0 ~- U9 V$ @2 r- Z* o } 5 x0 F7 ~! w! \9 n! e- B u ]
/ X7 |9 j s" Efunction checkform() 0 h0 O) \, G* T5 x
{
p! I. n* W9 K( f, ] id = document.sform1.id.value; ( ^6 s- K* b' G* y7 o$ n
if (id == "") 5 n& o& H1 o5 x4 ?
{
9 i R3 L9 G% c u& a0 S' Y alert("请输入注册名"); ! h. F. v1 t- w; r B9 X( |
document.sform1.id.focus(); 8 N3 w$ Z# _% r5 u* k1 K
return false; $ x) v6 `& \5 }+ C* r
}
9 @5 O: l; `% P8 [9 H/ W
) {: K8 [* E Z: [3 ?1 A, U: e for (nIndex=0; nIndex<id.length; nIndex++)
3 T* g- F0 t6 \ {
! Y7 a9 j }7 Z9 d" h+ U6 Z6 p+ ~ cCheck = id.charAt(nIndex);
F$ ~5 e* A9 y- F8 e0 W if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) " k8 ^& d; ]0 o( D+ P
{ % p6 ^3 {% \% P- Q% ]$ R
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 8 R- l! I; ?& R3 b3 M* @% e
document.sform1.id.focus();
" L* x0 B& f+ g# J {" s0 |! X/ m return false;
! F, N; _3 F6 M- _8 q9 ~ } 6 @" z/ E7 q' s9 S5 f: i
} 6 G8 B1 e/ ~/ O
chineseid = document.sform1.chineseid.value;
* y9 |( `+ I& F4 |8 i if (chineseid == "") - U# f3 l" ~& c
{ 1 o1 a0 X8 v) p& m
alert("请输入中文昵称"); . ^6 Y3 M, H5 r, ~
document.sform1.chineseid.focus();
2 U% |4 E; H" L. G return false; ! ^( x6 \ N. y/ S7 B8 P- d
}
0 W% b' ^( F |) e% e; g password = document.sform1.password.value;
$ c& I6 D% Q: s% M8 l if (password == "") 3 C( w' H8 {6 X2 r9 e
{
; l U, o3 u. n alert("请输入登陆密码");
9 V7 n: K7 S% R" q$ d; _ document.sform1.password.focus(); ; k2 Q Z% P1 ]/ d
return false;
$ W3 I$ s0 @1 l6 C }
! M3 t f/ b1 N$ L/ G: m password1 = document.sform1.password1.value; 1 ~( z7 {: o7 ]: }( `! w
if (password>password1) : A) \8 U, N3 c0 f) P4 F
{( j T' R: A; s8 |- a, J+ T0 U3 r5 p
alert("重复密码与登陆密码不相同"); " N# l0 l, H- i! h
document.sform1.password.focus();
* U4 }5 ^7 x. E `. W7 {) ] document.sform1.password1.focus(); : l7 X2 S* Y/ T7 n5 D
return false;9 B2 U5 L; D" ^. \, O$ F0 K! J7 J
} ( ~9 x: U& P5 h
if (password<password1)
' f& F N* k- _* c {
5 b) x: n7 ]$ x alert("重复密码与登陆密码不相同");
4 k* V# ^/ b9 d/ {; k8 H' X document.sform1.password.focus(); % n8 n2 [2 r: m
document.sform1.password1.focus(); . X* G8 x; }9 }' E/ T& \% W
return false;
, J1 F5 S# C/ y; Z9 ~ } & o$ S# `$ H) E4 d* r
if (document.sform1.email.value == "")
3 L d$ S$ q. h- H" H { ! b6 v- {' \6 l$ t7 V; F
alert("请输入您的E-MAIL地址");
9 P# B- S, ?- O: `% O+ \3 o document.sform1.email.focus(); 4 Z1 f Y7 i* | |) F( W$ n
return false; + h$ W' c3 H$ S! B0 I4 Q8 i
} 2 b( Q4 K+ t# J8 s
/ W, B$ o1 Y ^5 j5 V8 s3 a email=document.sform1.email.value; + l' {$ _& e9 g* [( h: M" }; }* g
emailerr=0
6 S2 q% }/ b2 j) i for (i=0; i<email.length; i++) , @+ G( R, B9 `
{ % ?4 |) _: H7 O ^, }# z
if ((email.charAt(i) == "@") & (email.length > 5)) 1 y2 Q6 p/ {. h r
{ 8 F+ K. F! \8 P+ Q+ l
emailerr=emailerr+1 ; x' x- {. u3 \ a2 Q
} $ V i, }( C# t2 u R7 Y
} 8 y3 Y3 @) C) x
if (emailerr != 1)
! ]5 [" ~- ]! j { 7 Y/ [0 [% _, z( m
alert("请输入正确的E-MAIL地址"); 0 }* R" p7 z2 v* u
document.sform1.email.focus(); 8 {- _7 V/ P: _" a1 ^, ^
return false;
1 S! F* Y0 k! i" \ } 9 ]/ Z2 Z7 C/ C% _4 O: e
( A8 a) | t9 g# n
if (document.sform1.checkask.value=="")
( J; ^" A5 M# F% P! D p( R" N7 i# f' p {
9 B0 N( d7 L) _" Q7 K- D; r9 N/ } alert("密码提示问题不能为空");
0 i& H0 {. L/ G5 u: t document.sform1.checkask.focus();
: y1 Y$ g/ N2 @ B# P7 c( ~ return false; % D/ R' r5 m/ @
} . B8 c2 S: |1 y& l: c t
if (document.sform1.checkans.value=="")
$ C5 ]8 [7 V( I& h( h& D+ h; T { $ \5 \, S7 }; k$ a0 @$ U3 Z
alert("您的密码提示问题答案不能为空"); / [7 v& A2 z( \
document.sform1.checkans.focus(); 7 c+ Q$ h1 h6 G/ h2 O+ s
return false; - p8 |6 X: U+ c. G; m
}
0 X4 R4 A8 p& I5 G return true;
# c$ J1 g) v7 {4 x# _& | . \8 g; o' o4 S# o+ ~1 q
}
: X, g) d/ L9 b4 o6 C. n# E</script> |
|