获得本站免费赞助空间请点这里
返回列表 发帖

网页之不断弹射的文字-特效

<style type="text/css">
' t; ^; Y" t1 x. C  u  D6 Y#supertext {8 n" N2 u# A  A, R
position:absolute;' p- M: \$ I4 @2 |4 a8 P
left:0;
" Y2 r. P- E0 l1 Ntop:0;/ u+ L( f1 V" b6 P' U
visibility:hide;
6 E/ Y8 ?3 R/ l% x7 `4 r* Uvisibility:hidden;& h/ d* U$ |8 Z7 {9 ~' Q( v
}0 C. o% }5 c) @& ^* V
</style>
7 }4 R5 G! k- G8 i, ]$ @<script language="JavaScript1.2">
  h3 ^5 @& c, w) F, r<!-- 改变下的字体的大小。颜色-->
5 ]1 L5 ~/ D* R" cvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
1 A) ^9 A$ n% g6 ovar hidetimer='';/ Z) n4 H5 Q: ]7 Y8 l2 G6 \
<!-- 改变下的弹跳速度-->
6 J7 u+ A, N& rvar BallSpeed = 20;1 q1 L* F9 q! o7 o4 C, |
var contentWidth;
% S, Y1 x4 R3 k; U( q/ b- V2 n; zvar contentHeight;: f: u  Z$ f9 X! l; `
var maxBallSpeed = 50;
  r: m9 I" ?; h6 q/ _: i' ?. e2 y
( P' U4 ^, _, K: }  s5 v
9 H2 |5 j0 R/ T1 K+ z& C* q3 T4 G8 ^2 hvar xMax;
+ A: h9 t( [5 U5 n0 ^8 e7 P  L* z1 wvar yMax;
, }* o, R  T6 j4 x, \; Yvar xPos = 0;& d3 d- n. V6 L2 S+ Q% J
var yPos = 0;7 r8 m& b$ B7 Y3 L0 F( ]+ \
var xDir = 'right';
6 P- @9 M8 }# H+ ]$ i" m7 \6 ivar yDir = 'down';
/ r- H$ O5 |9 d' @+ O9 V! zvar superballRunning = true;
, b) ]# v  c) }% g0 x% hvar tempBallSpeed;
& K' D7 l, A. A0 z5 ]3 lvar currentBallSrc;8 Y7 N6 e4 x# o- L# K. B! I7 _' ?
var newXDir;; X. K& n! o( q& ~* `+ C( z+ d
var newYDir;
5 `% i1 n" C0 ]% P
) L+ b, g) F9 E! dfunction initializeBall() {* v1 n6 D0 o+ l
   if (document.all) {
* `5 z. F7 d2 X4 i      xMax = document.body.clientWidth
0 G& W! L2 B# L. N      yMax = document.body.clientHeight: t: u1 A3 N  h' k' ^
      document.all("supertext").style.visibility = "visible";3 \1 P. A& W" Z
      contentWidth=supertext.offsetWidth
; K- q$ @/ {( L) O/ ]2 m2 P; G      contentHeight=supertext.offsetHeight2 F  M. G' d) n- b) j
      }
6 u* H( p7 R: w4 E   else if (document.layers) {
7 {4 \4 F- h6 L* O' a5 W8 n      xMax = window.innerWidth;
8 w, Z  n/ N2 L: B      yMax = window.innerHeight;* [6 D8 M+ v! ^/ e  \( r# O- P
      contentWidth=document.supertext.document.width2 d/ Y4 p5 j. ~7 n' f' D
      contentHeight=document.supertext.document.height1 M. c) B4 `2 m
      document.layers["supertext"].visibility = "show";, D- x# K- a' n* k5 ~
      }+ d5 A0 W) L$ @: A: C0 N( o
   setTimeout('moveBall()',400);
, j. j4 m# ]. ?   if (hidetimer!='')% V" m7 C% x5 h0 ^2 T' I4 U
   setTimeout("hidetext()",hidetimer), A( `$ ]6 u7 V; h1 g
   }
+ @* T( c* `: I: R" A5 |0 U
: j$ B3 ?# E- l  {: V8 K: sfunction moveBall() {/ ]0 W9 q! v. b$ t3 a- A
   if (superballRunning == true) {0 I( l" U( e: z) W0 j3 b
      calculatePosition();5 q' z' M& g2 m5 h+ i+ z( d
      if (document.all) {& n6 ?& i' q) K* n/ A& S! S. f
         document.all("supertext").style.left = xPos + document.body.scrollLeft;+ d2 _0 q' V& [+ _/ S( d
         document.all("supertext").style.top = yPos + document.body.scrollTop;
2 w; b* x) D7 x, ~! a, r3 n         }) Z; d5 A1 h5 ]3 o
      else if (document.layers) {# T9 X5 K  u6 P$ ]1 P3 h8 S6 [
         document.layers["supertext"].left = xPos + pageXOffset;
# J& h# _" `+ E4 W         document.layers["supertext"].top = yPos + pageYOffset;
6 K% q. O2 _8 H$ M1 {7 A, V) n! W         }/ v1 K+ C+ Y0 T, T8 g
      animatetext=setTimeout('moveBall()',20);
+ t0 O" h6 k! X! x      }4 ]! a8 {# w. M5 _4 a/ ?
   }1 M' E4 O2 P+ v7 Z) o) l. T( J+ A
3 Q; f  E8 q' C6 m# C  C4 K
function calculatePosition() {
% p9 Z4 c) {* K. V0 z- o   if (xDir == "right") {
' q+ x' z/ g- S3 B3 y      if (xPos > (xMax - contentWidth - BallSpeed)) {
2 t% `7 M) x6 z7 ]3 O; ^5 d2 m         xDir = "left";# R3 w; o, K+ F6 `' A6 I: E: E
         }$ O# J+ o! s  m% j5 a# S  n5 H5 m
      }+ ]* b( n' K4 Y4 \7 K0 m; ^
   else if (xDir == "left") {( u3 ~' g/ R  r2 }7 [% }
      if (xPos < (0 + BallSpeed)) {
  I7 @8 ^2 ~8 c% k/ ?6 Q         xDir = "right";2 j8 k, ~8 \+ c
         }
: q; v: W6 A6 C' h, o8 Y      }
+ N: o7 ^$ X" }' x8 `; N" U9 v   if (yDir == "down") {
5 U% C& \6 t  {' M      if (yPos > (yMax - contentHeight - BallSpeed)) {$ z' I% U$ f) h# I- E) x
         yDir = "up";
" O- ^1 K7 F3 ~- a, z6 h9 a# b  a: I         }# L/ U! V! h* `2 M- x0 W/ W
      }8 p" K4 _2 G" ^3 o: h+ |
   else if (yDir == "up") {
2 O) ?3 k1 _# |# m+ r      if (yPos < (0 + BallSpeed)) {% F9 K" X" ^3 B
         yDir = "down";$ `8 F  e! l- H! n3 T1 d
         }( |0 Z4 B5 ]$ K5 w
      }, ]6 y' t: A* n: \& q, ^8 G) D+ l; \
   if (xDir == "right") {
( r3 ~% r( B) B3 k4 y4 ~      xPos = xPos + BallSpeed;7 e$ ?& Y2 F! E' x0 i( C9 u
      }
1 [# ?! j" i2 L8 D$ T   else if (xDir == "left") {
# C& D" [8 f! @) E: h( o# ]      xPos = xPos - BallSpeed;! o% r# H2 n3 I: U2 r' W" H
      }
4 c. ~1 |! }7 f/ k0 ?   else {" }- X9 k7 O3 ]- Q/ ~( X6 V
      xPos = xPos;+ @, z9 J! ], D- Q& N- R$ X" t. V
      }
( ~1 @$ e0 h% w, [: C: t( y   if (yDir == "down") {, S3 t) l: P2 h) F1 K
      yPos = yPos + BallSpeed;- M6 q" ^, a6 g6 |& K7 Y. j
      }
0 ?6 [/ `5 ?+ E5 p   else if (yDir == "up") {
* {' s+ S+ A6 ~  A      yPos = yPos - BallSpeed;, u9 V0 }4 ~9 |+ y% M
      }
% y% H" e- k& {5 K  ^3 q& ]# s   else {. [, `3 N' R4 s; K/ Q! s: n
      yPos = yPos;, L9 a% f+ r" _' ]) k+ V; }! p
      }
! x+ ^6 O& L8 ?0 e) t4 e   }
0 Y7 K% x0 ~0 q' o- G$ c0 q
# p% y1 a" l; y1 [% ]; j  u3 o; e; hfunction hidetext(){
/ o8 u8 U: n: Y$ Qif (document.all)7 x! d0 g2 A8 q+ a0 V! D
supertext.style.visibility="hidden"
$ ]4 g# k2 X: o, @8 i& J. q& oelse if (document.layers)5 o: ]3 U, _5 t$ c. i) L
document.supertext.visibility="hide"
+ v# W( Q2 n8 b! P  cclearTimeout(animatetext)
1 T! W. [! b& J) D8 b}2 |- I, ?5 @: ^  w% Z6 N
3 C0 I  s; A6 ?. O
if (document.all||document.layers){3 F& ^  J6 v: o$ b0 s: x
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')0 f8 ^0 |3 y1 A
window.onload = initializeBall;+ o, v2 o( F9 C; a9 W' g, P/ C; \- |8 b
window.onresize = new Function("window.location.reload()");
0 Z0 m# L1 v, l; b5 L}7 D4 U" `1 P7 I4 i
) J2 I' B6 c: L) G# l; M9 J6 O
</script>

返回列表
【捌玖网络】已经运行: