|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
这个脚本对你可能有帮助:
! }) ^8 n8 b6 U k( ]<script language="javascript">
" _9 y. ^" P" K6 ^* Ffunction IsDigit(cCheck)
* W- F/ r) Q( j# p% {5 K) A {
3 h0 K! H1 h, F* E* ^$ S: D return (('0'<=cCheck) && (cCheck<='9')); " O$ Q% }; G- ]# u
} ( c3 L+ X9 O/ h/ }6 ]3 }
0 M2 G; G) ^( Q7 S" ?
function IsAlpha(cCheck)
; e9 Z! x H: J( q1 x% U2 O1 u1 n { + b( g5 r' j$ m" ]) B
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 3 q2 N* q, r& C/ I5 i
} ! N+ ?9 \ ^, t' K) u6 h8 \
1 j2 X1 o: w4 n9 {( K( [ h7 Q0 l
function IsaNull(cCheck)
+ Z) s% Y9 Z) Q) E5 o% G/ r {
9 O/ F- A( T+ M' Z2 q) L return(cCheck != " ") , e e# t: G# x0 w: J, _
}
$ h2 I7 R1 v' V! z5 Y 7 f: t {+ h% t. l( {/ Q
function checkform() 0 a, D; G) x* j+ t0 M3 X" R F
{
: Z1 D, M8 h; p% s id = document.sform1.id.value;
" N, K! I; j% H if (id == "") + A! e7 D; g }, n0 v s( T
{
" D9 O% _3 W! e0 t' c alert("请输入注册名"); 8 x2 H8 f7 a! s; K
document.sform1.id.focus();
+ }3 o3 k2 t+ @ return false; / `/ ~3 q. j5 F
} , ^- s/ M9 U8 o) j/ k1 x. Y! u) H
# T, \/ P" F @+ A" g* e# s) l for (nIndex=0; nIndex<id.length; nIndex++)
6 j; p1 D* z# U# X& Q% a { 5 w( t- g T+ y+ p9 j9 \7 b
cCheck = id.charAt(nIndex);
9 E/ T; Z6 O8 @3 f6 `' }* a' t- G if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) & W- ?" Z" C: [. Z( J
{
! e5 m' ?* t. C6 ]4 F/ B alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); & v$ ^' S3 e5 m
document.sform1.id.focus(); ' e* G) b! ~0 M) i1 w6 y# f
return false;
# ^1 g0 ?7 v! W! E! s; K }
4 Y U3 r& w3 s) X! o: K } % P' a1 v, s& T. ~" |1 H
chineseid = document.sform1.chineseid.value;
4 Z; m; I- E5 T! k) Y3 @1 U if (chineseid == "")
$ V# j6 N8 S( K, p5 G: n1 q5 q! J { * K, m) {! G# f* @& t) F
alert("请输入中文昵称"); $ Q& y8 ? H5 z( K) k
document.sform1.chineseid.focus();
4 B. G% c3 [3 `# m7 S% [8 G/ z. W return false;
; ]) o+ k a" D } - C9 j3 _9 }9 Y% q c/ U3 H
password = document.sform1.password.value; # ~/ r) J4 F [8 c7 P- J- B
if (password == "") 2 ?) O1 ~) T( q/ H
{
4 |9 G2 E- c0 ` alert("请输入登陆密码");
. W& C) |* q- }& V5 Q/ P' v, \ document.sform1.password.focus();
! U1 z! i6 L1 d- O return false;
* i' z; C: p% V7 b8 L2 X } 9 d; D' l5 S, t4 `8 O$ ]5 U
password1 = document.sform1.password1.value; : Q. q& c, o% e& C& f
if (password>password1) * Y% M) {& M. I: z8 y. M4 |
{
& D! t, q: l- _! B alert("重复密码与登陆密码不相同");
8 J$ Y* I! m# U# C1 j$ ` document.sform1.password.focus(); + n# G& ]7 ^% h, a) G+ \, a2 D
document.sform1.password1.focus(); @# e8 ], B0 O+ b4 G/ g. ?1 x& _
return false;" e8 K, I. p$ a# `6 N! Q9 y
}
& L, |$ ^0 `. T9 s% H0 R5 Uif (password<password1)
/ [/ Q+ h. h1 H {9 H9 J, M" O0 S9 o
alert("重复密码与登陆密码不相同");
~( g7 o5 b3 p, F, f6 Z/ p document.sform1.password.focus();
' Y8 }& @" ?- A document.sform1.password1.focus(); 1 U# o8 w3 T) t
return false;
! i; P# [' E( X& Y" y9 o } ) e6 j' ~# W7 k G! Y
if (document.sform1.email.value == "") $ c" c I9 I# s) ^
{
$ M5 z. l5 W; ]& K; |9 o$ [& i alert("请输入您的E-MAIL地址"); * y# s$ k+ V3 W5 {
document.sform1.email.focus();
' B0 U2 l) ~7 M return false;
& d M! N- W0 B+ n% O& d }
+ }0 y X) ]' b7 ?, U4 e ( B$ S3 }6 M7 C
email=document.sform1.email.value;
! ~4 s+ P- B" ? ]" l$ z' Y1 P& V emailerr=0 + s; _/ Y4 m- a+ p: ^1 m) P
for (i=0; i<email.length; i++) 8 G; u0 M& S1 o8 @: q) [
{ 4 u1 m2 L0 w5 e1 E8 [5 @7 ^ s& w" l
if ((email.charAt(i) == "@") & (email.length > 5))
6 E' [/ ]* ?: Z( b2 S2 q* w* F {
' z8 F) H J3 T; R0 T% e emailerr=emailerr+1
8 [: d" J7 U6 C _! u } ! ?1 E( Y- u! L* p+ X4 L) N
}
O$ v" G3 @% c! b8 G" C if (emailerr != 1)
% {7 B7 U, V, P: A {
1 t1 T+ o0 }$ M/ q6 F% z1 f alert("请输入正确的E-MAIL地址");
G% i8 J8 g% C8 P5 S s document.sform1.email.focus(); 5 Z( k7 G# ] V. r, V+ s
return false; 0 L( g4 v$ K+ n" v
} " X5 ^5 z; t! [' [; f
- ?* \' O" r% l8 v
if (document.sform1.checkask.value=="") + e. s4 K' i. `+ \4 S: H
{
: s D' u% [$ g5 `! j- c( x% `6 ~2 V alert("密码提示问题不能为空");
, M3 u% t, V @! M+ W( B+ ~ document.sform1.checkask.focus(); # C$ |5 [$ {7 b- y4 y
return false; : P+ t8 a- W W1 F$ p
} - \: E4 F5 @; {: N$ [0 h
if (document.sform1.checkans.value=="")
- L4 n X/ J6 e+ y& s) U! m { ) g! D' a0 Y/ f8 n4 X+ w. X
alert("您的密码提示问题答案不能为空"); . V) C- ]$ O0 g) `+ P+ D- ~; _9 m
document.sform1.checkans.focus(); ( L' d) V; S% N j9 b* U( Q8 [
return false; " F8 m* g p% Q' z
}# ~0 O& b( c5 {2 L" H
return true; * I7 ~% o% R) z
: [! _" i6 u) t/ \, y4 V
} 1 f# S) N; v0 ]' d2 Y7 g/ l
</script> |
|