|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14371
- 金币
- 2471
- 威望
- 1647
- 贡献
- 1419
|
这个脚本对你可能有帮助:
, A# K- L$ |9 s8 D3 s) _<script language="javascript">
2 K1 n" t) x" k, K! p: ^1 rfunction IsDigit(cCheck)
0 J3 p" O: O( _& o9 S {
9 A, u/ \& d3 g( i+ Z, E8 q% a, g return (('0'<=cCheck) && (cCheck<='9'));
: D2 t) s0 C4 Y } " \3 M( g/ N) N. j' b( L
, C( H+ S$ J- @! L: P$ H! N5 pfunction IsAlpha(cCheck)
3 w4 n% i [, R8 z% a {
3 n8 K v; \4 v+ \' F9 g( \ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 v' j4 l8 r r1 h/ ]& l
} ) R) T0 _2 N4 x
# I' r2 s3 Q$ |
function IsaNull(cCheck)
% T( P4 L: ]( {0 }- A1 V5 L {
/ j" v4 Y$ Y, x: j/ N- ? return(cCheck != " ") ) ?% ?# v0 Y% f, [1 d2 y5 L( _
}
, s5 w* Q j7 W4 W* y5 @3 Z% r, ?4 e
- |/ b4 x; e$ E0 ~function checkform() : G/ Z& n% i1 x ?
{ - c& k. x: A- [
id = document.sform1.id.value;
: U4 h$ c# Z( v8 }" m h5 x) ] if (id == "") ! R& a: s9 O+ C0 U! B, L
{ . o- z2 d6 v* R& S' w( W
alert("请输入注册名"); 3 U( s8 ]" \: T& ~! l0 _5 e& V$ N
document.sform1.id.focus(); & d% H* p. T! m) k, I( s. o
return false;
3 \% F9 f; R+ V, Q }
! J. j# {) }4 s$ j" C; W
# r6 g/ F" w2 ^1 U; z7 P3 | for (nIndex=0; nIndex<id.length; nIndex++)
q3 w3 { `. _ _ {
5 ~$ i7 A+ u% E% O cCheck = id.charAt(nIndex);
; R u$ Q6 w# r if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
& J r2 h7 q6 D& g/ l, N. e { 4 H2 U( _0 g9 {2 Y5 w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - z) q3 P Y) A. b
document.sform1.id.focus();
4 G( _0 g' Z# x. i8 {6 A return false; ; f2 N, ^: P% G) y
} . G/ ?/ x* L( O
}
0 G# L2 Z5 A7 d9 e chineseid = document.sform1.chineseid.value; + X |! B8 u& Y6 h8 b1 s2 \
if (chineseid == "")
: f4 a; z, g2 X$ I {
: K; Q5 e* j& T4 L- }; P alert("请输入中文昵称");
7 L9 H; U& G" D# C7 p document.sform1.chineseid.focus(); + J& L: V4 q2 I4 B1 y$ c
return false;
% q, [5 O- R% B& f. |/ z }
" O* S/ S- r; }4 z5 r+ W! e: p password = document.sform1.password.value;
& I$ i% v0 q: K7 j if (password == "")
5 r/ X& v0 |' l2 Q/ e {
4 G7 e: r4 e6 d* I7 c5 z; n# l F" P# ] q; z alert("请输入登陆密码"); : v' A+ x/ x" E; k# U
document.sform1.password.focus(); " z' ]/ h; P9 |6 j! x4 H( w5 v
return false; . l, q+ q% D/ d3 S5 |: ]8 h9 r
}
& O1 J. L s- f& z4 f) J password1 = document.sform1.password1.value;
" o ?6 k a( M if (password>password1) % G0 o( N' E* f
{
. ?. ~+ H8 z2 W: \6 {" ? alert("重复密码与登陆密码不相同");
( n, b) a6 E5 a: ^8 P V& ] document.sform1.password.focus(); 7 y8 o: V# x! K! P7 f6 I
document.sform1.password1.focus(); 1 ]' ^6 e* ?5 f! x
return false;3 K' a- k, y5 ^) I! J- l
} ( X0 ]0 X/ o5 N
if (password<password1)
! U6 c! N! W: Q+ G6 j. E {
* A: a7 P+ h; C( F/ }* l# e alert("重复密码与登陆密码不相同");
9 w c6 a- n% \ document.sform1.password.focus(); % k4 V5 f8 t. w2 h5 G# C) V
document.sform1.password1.focus();
9 q2 I. J. u" D2 F& G* X7 O4 A4 Z" X return false;
+ J3 l+ e! H* z& _+ F+ E: v2 K }
/ _) l4 ~, Z, c if (document.sform1.email.value == "")
% X# g5 i( a6 [: M+ K { * s' o# [, n6 u/ _! ^) r/ }+ A
alert("请输入您的E-MAIL地址"); ; h3 H, V% [1 }5 b
document.sform1.email.focus(); $ g3 m% J* f$ q. S2 S4 I3 U
return false; + i( B$ \6 w2 t0 J$ o4 n5 {7 O
} ( u4 L) X$ R' s" l8 w/ V, `: r
- I6 z) W& S" S1 } V* k9 I email=document.sform1.email.value; 3 U4 `9 C/ h/ d+ Z( j" D/ F
emailerr=0
- \+ K; M3 \) }' }! D5 D for (i=0; i<email.length; i++) ; p! q' V8 `6 x$ W. O* k a0 O
{
, m% w; c/ ?! z if ((email.charAt(i) == "@") & (email.length > 5))
: Z, D i5 _5 J! ~ { $ @# ^# V) q; ~$ I, s+ l
emailerr=emailerr+1 # H9 [3 u* P5 A5 k8 V
}
H, o R/ ~, M$ K1 @' U }
( F2 h3 S& n n8 }3 L if (emailerr != 1) 0 w, | D! d2 S' m, m
{
y1 ^6 d' H M0 N, g alert("请输入正确的E-MAIL地址");
2 O) r0 ?6 K9 ]+ K. l- b' o% D document.sform1.email.focus();
2 K0 ?: h; e" M4 E- D7 |* B return false;
9 y4 M R: b( X5 b7 { } 9 z9 C7 L/ G, r/ R- L, U! `
4 X7 Z0 l4 B0 `) y6 [( F B& A! l o4 q if (document.sform1.checkask.value=="") 9 f2 Y' Y( K* ~- U
{
% Y/ f5 m# C: m4 j4 u( L' c alert("密码提示问题不能为空"); 5 M. x# y% D2 R/ Q2 _
document.sform1.checkask.focus(); 4 }6 k. r9 `# v) M7 J# ~
return false;
" Z8 y) e* L: H5 ~, k2 p }
& p8 T6 c* k0 i+ t1 W( _! ^ if (document.sform1.checkans.value=="") ! O' ]8 K8 t8 b: |, ]1 Y% }* i/ b4 E
{ 7 L, B2 N1 X' U/ R( H9 u: s: R
alert("您的密码提示问题答案不能为空");
% _& \' X9 z; n% O document.sform1.checkans.focus();
* q- G2 E# V( o/ s+ m* u. S2 }0 d return false; 8 k+ n7 T0 H/ V+ I1 p4 G
}
5 P% a5 P; k" z, H. V1 h5 K5 U return true; 3 c8 j& p, g4 ?9 U( C5 }/ \
# j v3 E0 i0 L( s, {}
& D+ k4 Q8 h8 W</script> |
|