|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14373
- 金币
- 2472
- 威望
- 1647
- 贡献
- 1420
|
这个脚本对你可能有帮助:5 y7 k% X3 O* A, T, E; n
<script language="javascript"> 3 ^: ?! x% G( |
function IsDigit(cCheck) " Q: [9 v( ]: I* Z' a' T0 f5 L
{
, G0 A R4 A( Y" r1 T return (('0'<=cCheck) && (cCheck<='9'));
- Z% p. h9 \" \ }
: E( A5 X; z% q9 Y# b! I : p/ G: c; L3 o* c
function IsAlpha(cCheck)
, e' N3 J7 R/ Q0 d; ~) ^+ u { 5 [9 F) V M; N# S2 k; V5 ^
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" g& T" k+ X+ _% r* k j0 Q }
1 l* M" C0 }& t: D U& o
3 V5 j6 }! A" n8 j1 lfunction IsaNull(cCheck) # i. \4 Z/ n& W- L% e" F: ]
{ 2 H, H n) O% [1 P8 U9 U; }: S+ R$ |
return(cCheck != " ") 6 M! H; [7 f- {" a$ t: y
} * W/ {. Q! K9 g! Y' T% ^- R
" } c% @; n L: @$ D; `function checkform() 3 }' X a$ n% v. J" k
{ S& L8 K. V) R) N. h v, C9 R
id = document.sform1.id.value;
6 a, g! L, l& |+ A8 v5 Z if (id == "") + c: i2 O' x: }: R5 k
{ ; P" q( S3 K; n9 J6 S& I& q
alert("请输入注册名"); 5 Q4 X- V. `5 l& N( o
document.sform1.id.focus();
0 u/ K: b7 s' X% \! l7 u+ c0 F return false;
. O3 D1 a5 k7 l0 T } 6 X% [% \/ R) S
0 y( ?9 P. S2 w- y/ e& U& N7 @
for (nIndex=0; nIndex<id.length; nIndex++) - J& t8 C' _. X1 {; O
{
* U. }7 e' W& j- f8 M: U( R3 ? cCheck = id.charAt(nIndex);
, w* W/ U- R! x. E/ ~- [3 T if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 q& r# ]5 w% r0 Y5 A8 V0 R {
8 ]/ @, T+ n9 c- B& x alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); " Y, i% f; Q2 V+ S# {
document.sform1.id.focus();
/ v; R! S0 e5 R' ^8 s& P+ n9 T3 v4 @ return false;
/ c4 n5 ~% E/ j% s7 A, b8 A } - L2 v F' L2 Y3 b# C
} * w3 G4 V2 r" v. Q1 x
chineseid = document.sform1.chineseid.value;
# `7 K8 j6 F) o9 P$ \/ @7 p9 v if (chineseid == "") ) D1 R2 X5 [, Q* x& B
{
2 \7 A8 z* L* d* P alert("请输入中文昵称");
/ ]6 \2 Z( S) O5 ^- z8 Q. {9 J document.sform1.chineseid.focus(); 5 C7 K* Z2 D( C+ [: M! R
return false; % |* q" w+ f; ?7 Z
}
I' q4 `+ p2 G password = document.sform1.password.value; J5 e; p( d% U
if (password == "")
, U7 I- n7 A+ q1 f {
3 w R1 G& L } |/ L alert("请输入登陆密码");
e# J5 z: i$ g$ b document.sform1.password.focus();
9 T: F* A' {. t7 @' ?5 E9 f return false; ) B) l3 }' t) |' c/ U
} v7 _; ^7 |+ V# ^: e
password1 = document.sform1.password1.value; - u5 l# y3 {) I6 g
if (password>password1) * B5 w+ \. c7 r) H6 J; D# b
{% m% U' N* x1 H* ^
alert("重复密码与登陆密码不相同"); % s2 V( I& A" U. y3 @
document.sform1.password.focus(); $ W! r% w7 m# b, m4 K% k
document.sform1.password1.focus();
" ~8 o" H; H: Y" B6 g( |9 [ return false;
# X. S2 n+ g! a6 h } _4 h6 `3 l2 t, a; R) A8 y/ S
if (password<password1) ( u* K; r/ p& _5 h o z) r
{
) d t' t5 T1 { alert("重复密码与登陆密码不相同");
t/ |1 J7 C" v9 X document.sform1.password.focus(); ' C7 O& g7 M2 @$ v$ k
document.sform1.password1.focus();
$ a6 q" W0 u! W, ^0 k return false;
0 f% N8 p0 J( a& [* h5 r" g# M8 N } & ~# K0 {' a/ o: O' q: n6 }
if (document.sform1.email.value == "")
0 D ^2 r$ c( n6 F$ x# N" k2 ]! _2 N { ( {- t& a; m4 Y1 D5 Y
alert("请输入您的E-MAIL地址"); ) ` Q2 P5 i2 K* j' a/ \
document.sform1.email.focus();
; d9 v$ m2 j( q5 E; } return false; 4 r# s; t! G0 P |# n
} 7 V) \& Q9 ~: x: m* H4 p8 V( `
! | E. c" r0 f0 U( { email=document.sform1.email.value; ; e. d/ v) p9 S: K/ Y) X) E: S% k
emailerr=0 ; r9 g: D9 ^4 g$ d+ ?$ U
for (i=0; i<email.length; i++)
6 o7 r# q, x+ N- `* z {
1 f1 n; Y* n% J) ~% f; x! ^ if ((email.charAt(i) == "@") & (email.length > 5))
: V, t3 I! Z4 \% n; B {
' ], w/ |7 k8 l8 h" Z emailerr=emailerr+1
; e( q. f* c" E) b } ( {9 X; \" R" k/ G. n- g7 }
}
& O. ~, p9 i! ` if (emailerr != 1)
+ g7 H7 T0 L/ }. ~1 D { 1 |4 p) s5 ?4 h+ U+ w- M
alert("请输入正确的E-MAIL地址"); : M8 C' d8 ?0 u
document.sform1.email.focus(); 1 R1 k- j5 c. d( S4 A
return false; + Q* E0 X9 w0 ^) r f4 Y6 }
}
* c+ ^3 k" [" t0 H
9 h0 m. I9 W w7 a/ I( F& D if (document.sform1.checkask.value=="") 9 e3 \( T/ V. H) b7 f. ]; j4 M
{ 3 u; V @' d; Z. O: E7 L
alert("密码提示问题不能为空"); 2 O+ M; U) o% z8 D
document.sform1.checkask.focus(); 4 b7 l# F1 w1 C ]. x) e% K
return false; * C6 D* @ g) j* K1 K
}
0 N$ H$ N& ~6 r; ~* i: Z if (document.sform1.checkans.value=="")
/ e6 _( R1 u7 X+ d9 y& U {
% P5 c( _# z9 d! k1 ] alert("您的密码提示问题答案不能为空"); " H7 P0 R& W: |2 h% A z
document.sform1.checkans.focus();
8 s s: {. H3 b4 S/ Y1 s return false;
" V" P4 j7 |, b) m# {* E5 _8 S }
" ^2 Z! `" i( Z return true; 1 i4 o9 x) K" m) W8 n9 K
0 x e% c/ \. |- `! }} 8 F; m% c- h' k
</script> |
|