|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
这个脚本对你可能有帮助:0 t5 | E; |. K
<script language="javascript">
! F9 n- f) G7 G; l/ @function IsDigit(cCheck)
1 F1 {3 ?8 B3 L2 v: g {
& U2 |& n4 U3 z; ~( b return (('0'<=cCheck) && (cCheck<='9'));
( }! @: Q/ ]! p: w9 y) h" o } . [7 [' Z: R# Z: q' q
' F+ h+ k2 D% j; Z
function IsAlpha(cCheck) 2 ?5 @( ~" t7 `5 i y& Q7 r1 \
{ 8 y% r+ K( \, o' a
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
4 d( u' j* p8 S } ) S! _2 p2 ~8 b3 M
- L, T$ q6 F% [* g/ Rfunction IsaNull(cCheck)
7 B7 u& n, ~! d0 S" h9 f7 |% p, b {
. q5 O7 a6 J0 y" q& G, L" \0 ^1 w5 t: S( v return(cCheck != " ") D, s9 j1 L; d! v( p7 k
}
* G8 ^$ D+ O# B& M P
' r9 C2 C. M3 I5 A, Tfunction checkform() * J/ `/ ?5 j4 i0 {% ?0 H/ j
{ * Z& R& z U& \& a& C1 F' g
id = document.sform1.id.value;
1 }$ A" i* N6 S) z if (id == "") 6 ~ _, ^% j0 P" N5 M C1 {
{ & g9 Q9 _" O# b
alert("请输入注册名");
) e! ~1 ^& m( `: e8 |) `- I5 J* N* ^ document.sform1.id.focus();
_/ h2 i4 {% z+ ~ C! c% e return false; ( Q1 P6 j/ k* D f' T9 Y
} . @2 y4 z: L8 O" t, W8 ?3 }2 Y1 ]+ s
( o- V2 m( @ `4 r for (nIndex=0; nIndex<id.length; nIndex++)
; d/ n9 [/ m: w. J0 \) r( Y1 a {
7 {, H4 n9 V) P! c cCheck = id.charAt(nIndex);
6 A8 u# i. ?) i! A% w! p- D! R6 }6 c/ t if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
" x4 a' U3 L& @5 H2 r# e {
; t. g8 d2 y8 e3 t" t alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : q3 L: {. \$ R( X' Q; s" e
document.sform1.id.focus(); : D" x X/ `& Z! j
return false; * U4 q" y% P- L! X5 \' O' l
}
% j5 C( E5 B8 B' Y6 @ } 3 v6 @7 N" `( i' ^/ b1 o
chineseid = document.sform1.chineseid.value; 3 m1 ^" ^; A, g
if (chineseid == "") 1 S+ G7 S T9 H; S
{ 4 D7 v8 U) h2 T/ A8 d( z0 S
alert("请输入中文昵称");
' _" z9 X! I: f: B/ j, D& ? document.sform1.chineseid.focus();
* z: V9 {, `4 K* m1 i* X2 @ return false;
) I. Y7 r$ {" L! i3 r1 @6 T }
- j+ R, f# s$ \! R( @6 \/ N q3 H password = document.sform1.password.value;
7 b- B& b( [4 c- Q- ]5 L) q if (password == "") ' ~. ]" F) [5 Q# c* d3 _8 C
{ % [9 L! l4 K' e' Q% d s3 F9 S+ ~
alert("请输入登陆密码"); $ V/ g! e! E0 x! ^+ I! q7 F7 n; _
document.sform1.password.focus();
7 I7 `8 e; U" l; ?! ^ return false;
! k8 h$ U8 u! ^; x9 e }
/ ^0 y3 _- _( t/ P8 S/ o7 C password1 = document.sform1.password1.value; 8 K$ I! |# J- {& g
if (password>password1)
; {$ V& c( a% [' A {) B; {' f" @5 c. c; t l5 \$ q# g
alert("重复密码与登陆密码不相同"); : C6 q4 N5 n6 w f( G
document.sform1.password.focus();
b& ?* f/ ?- ~7 C document.sform1.password1.focus();
$ N: \& J, C6 W' V7 U return false;
Q; M; y+ j/ n6 J4 S1 l; R } 8 R& E# h6 ?$ [9 @- s
if (password<password1) ` |) o S5 Q n4 c
{
7 N8 n$ D7 @/ ~. U alert("重复密码与登陆密码不相同"); 7 d$ G: j6 a6 L# e, z- p! {# i
document.sform1.password.focus(); 4 @$ I8 s3 a: Y9 O
document.sform1.password1.focus(); 2 |' g0 g! V6 D7 f3 h0 Y; J- l
return false;8 g# H, G0 b9 n+ g" \! S/ z' s
}
' Q* B' H4 Z4 K' s5 ^" E; Z, r# z- O if (document.sform1.email.value == "")
5 [1 d/ O, S, P5 O- Y2 ? { 8 k, P6 S/ e$ }- R5 M
alert("请输入您的E-MAIL地址"); / F2 {" d! f. K z, s# d _
document.sform1.email.focus();
7 p' u* r9 X/ e: c! I return false;
/ ]) t$ H. V0 `- f6 Z6 J }
8 b8 R, { x1 u' f9 H 8 ]* O2 ^7 ^- ^0 R1 Q l' }
email=document.sform1.email.value;
% }* ~* Q& Y9 ]0 i emailerr=0
: M7 A# d5 N. T for (i=0; i<email.length; i++)
, U+ h( ]9 n. u: P( D { . D% p9 K1 v+ M- ?$ F; j( ]
if ((email.charAt(i) == "@") & (email.length > 5))
3 ~' [) r. N- I( C {
4 N- L: h4 A/ v, M emailerr=emailerr+1 ) t: |( ?/ I( y! c1 T; X, X2 A
} R! K# q1 x6 O4 E8 Q( H4 m5 E# Z* z% \
}
% j: B* b2 s g+ X* L if (emailerr != 1)
8 W( q" b3 [: z& @' I {
. s8 p9 ?0 j; V: m% @ @0 z alert("请输入正确的E-MAIL地址"); ' r8 L! e& s% t+ q2 o7 V
document.sform1.email.focus(); 0 x5 D1 s1 M& u2 L, D
return false; , Z" m' m0 m, m+ L2 L
}
: R/ X9 P7 T* U7 H, _0 z6 P
+ N4 P' G0 a, ~& D, B if (document.sform1.checkask.value=="") * V$ D) u& z9 I- L% S
{ $ _& t/ z" G* p; d6 C* j! T- d
alert("密码提示问题不能为空");
: `! T( _" s7 K& B9 Y2 M document.sform1.checkask.focus();
! |" G+ H. v& G- Z return false;
% @2 D2 ` \7 ]* W# k }
3 H* _9 y. V' p: B5 A( H+ U/ H if (document.sform1.checkans.value=="")
_. `1 Y9 Q2 m5 b- z: c0 p {
+ N% t# w7 d/ @: b( C alert("您的密码提示问题答案不能为空");
. P7 h, v; Y+ Q( e document.sform1.checkans.focus();
! } j( r+ D8 q9 H6 D return false;
; Z# h/ ]1 k, B0 l! _) C }
5 x: r" \$ K n, Z+ K) j return true; ( q1 f9 V% k2 H: ]0 y* i
# p( G! M \- I$ u+ b/ ^$ ^
}
% ?1 M$ I1 H5 C$ z</script> |
|