返回列表 发帖

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

<style type="text/css">
! W% Q6 {4 O: ]' ?#supertext {5 e3 m6 x& F' g! Y0 e! t5 U
position:absolute;
1 A, t/ H6 N; {6 C8 Aleft:0;
: e4 }9 T. P( A# F) ?top:0;9 u9 i) y5 ~/ S
visibility:hide;
( }/ n% ~9 s: }# wvisibility:hidden;4 }% b( V8 |; s
}
! |1 r$ m" C6 ]  D+ @$ |3 x</style>
: x0 L% \! ?1 k; V<script language="JavaScript1.2">1 C' @! i. A5 @3 s0 n9 k" j2 ^
<!-- 改变下的字体的大小。颜色-->) p( y0 Y. T9 [, \) n( H# u
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
, l* Z% _; t" i4 @9 D8 fvar hidetimer='';6 t- {) Q" e2 J
<!-- 改变下的弹跳速度-->
4 i2 m! h2 d& jvar BallSpeed = 20;- ~0 z8 `: J% L' @( w- `
var contentWidth;3 `3 T, i6 }3 t* U$ k4 r3 C- E
var contentHeight;# w! W: x; k, X* x$ Q
var maxBallSpeed = 50;
" h& |3 M! x, a5 b9 y
* }3 @. d/ B! t; F4 i. t1 R  S, |4 {" h+ d; V
var xMax;
  W1 h) a0 S2 y! V) Cvar yMax;* J! w  ^: T, _) R
var xPos = 0;! q3 O  w$ j* u6 U7 \. `* A+ u
var yPos = 0;
! j, V& e# Y5 E0 l- ]var xDir = 'right';: Z) @8 D$ j9 i% @% D$ V
var yDir = 'down';$ K# A2 Z: Q6 ?5 O+ y& e# S
var superballRunning = true;
$ X4 [, s5 }$ z- n% }3 k- w4 z* J) hvar tempBallSpeed;
2 ?8 `9 z* s7 nvar currentBallSrc;; n5 F  S5 `- ~" G
var newXDir;$ _# y% x; {+ w6 g* w* X5 E( B
var newYDir;3 s8 P& y# F1 N$ G0 q
" Q) F; u+ Z( R8 V
function initializeBall() {
$ }; V( f, {2 h3 z. w) r( w( |7 @   if (document.all) {
# m( D$ g, u& w/ x1 ^3 ~2 X      xMax = document.body.clientWidth4 q7 e4 T/ A, }3 J$ Z3 c$ q9 I: g# n
      yMax = document.body.clientHeight+ T( q: D. Z) m) M# F4 E9 b
      document.all("supertext").style.visibility = "visible";6 h& Y/ z* Z) b- o8 D/ J% e
      contentWidth=supertext.offsetWidth7 u- c6 J" r+ G: E
      contentHeight=supertext.offsetHeight
( T; g; M2 T6 g6 S      }, y6 O. J& c7 p
   else if (document.layers) {6 h$ x0 i( G( K% m6 S9 E. m
      xMax = window.innerWidth;
1 V5 \) d9 t6 }; t. \& @" T  O& O      yMax = window.innerHeight;# J/ J5 r" B9 x: }2 }: r3 s% \
      contentWidth=document.supertext.document.width
" G" g, N% r; b1 b( ~+ X      contentHeight=document.supertext.document.height
2 P" `' }0 `' Z+ [      document.layers["supertext"].visibility = "show";; _1 @0 P% t2 Y# _2 _2 D% S* D
      }" v8 l+ w' x4 B' y% J. W
   setTimeout('moveBall()',400);! ~8 k+ ?. X1 u. ^1 k  _% U1 S
   if (hidetimer!='')
  o2 W/ W: V5 {2 i( f; m   setTimeout("hidetext()",hidetimer)
6 T+ s1 v# @3 U! \8 ]   }
  t8 y, I- _/ E+ ~
5 i' ?6 i5 ^8 |4 A! ]$ Ufunction moveBall() {1 ~7 M/ }6 r* C! K- K( K$ Q
   if (superballRunning == true) {& B& a8 `5 B- _
      calculatePosition();- y7 [$ [3 g) y1 z: v8 F4 |* H
      if (document.all) {7 y. @3 @& N* i2 P0 @
         document.all("supertext").style.left = xPos + document.body.scrollLeft;7 F  _1 }8 @! b! s7 ?+ g. x
         document.all("supertext").style.top = yPos + document.body.scrollTop;
, K7 Q  x9 z2 R         }6 [1 L" |' N8 u* m8 x9 p
      else if (document.layers) {- K1 E2 v! T6 i: ^8 F* L0 O
         document.layers["supertext"].left = xPos + pageXOffset;
( ^# q% r0 m7 o( {+ H0 L         document.layers["supertext"].top = yPos + pageYOffset;
' T" `. ~) l( T$ o! m, A; K         }
+ g. H3 I" i5 |; ?& k6 P, B      animatetext=setTimeout('moveBall()',20);  J! e+ x5 a. d) {' w: G  L$ x
      }
1 c* z+ H" h9 P9 N- P   }
* Y" V- b9 s4 b0 V, B+ x
  e* ^0 T. z1 _) W" ]* Pfunction calculatePosition() {
: t, p, _. M. f2 |   if (xDir == "right") {6 `0 J  J3 W  U
      if (xPos > (xMax - contentWidth - BallSpeed)) {
7 [* R; r6 ?0 t- h# ]         xDir = "left";% W7 h* t: F* M' S
         }
! F) a: N! N4 c- v% M$ {      }
6 X* w4 J  R2 r/ b% r' w6 |   else if (xDir == "left") {
+ Q" S) s. b' ]: O      if (xPos < (0 + BallSpeed)) {
" A1 x) E  y2 e0 A         xDir = "right";: A' U0 ]/ w$ X( @6 ~; U
         }
9 P1 ?8 W9 _0 H0 c7 X6 h      }
# K7 Q$ y0 U  l   if (yDir == "down") {
3 c/ C/ \7 ]! y) n1 x& q/ W      if (yPos > (yMax - contentHeight - BallSpeed)) {9 m. W9 Q; S3 j% n
         yDir = "up";/ q$ g3 [; O- Z$ r1 o
         }
6 n5 A# Q5 I2 g8 x& M" L5 G, j      }
$ r- h; _1 y: V0 u8 b  _& f6 Q/ w   else if (yDir == "up") {& T6 q; h1 K1 D: ]; t9 h+ A
      if (yPos < (0 + BallSpeed)) {6 c6 R! C3 _9 H5 U. x
         yDir = "down";5 ~1 q$ ~" z6 h0 u3 d( z
         }) D: [: ]/ K! W% ]
      }: F' N: K& j$ B6 D
   if (xDir == "right") {
/ f3 F* i0 z% p+ c9 a3 L7 |( U      xPos = xPos + BallSpeed;
4 ?. q1 h6 S8 W. |# D      }
8 H. g7 O% t% h   else if (xDir == "left") {! z6 A) ~9 e, B4 O$ d+ ~  U+ `# P$ s4 X
      xPos = xPos - BallSpeed;
6 I  y& K8 F8 y      }
4 N9 t2 c  \* ]/ Q+ O   else {
$ y; F% b/ O+ g5 E# B      xPos = xPos;
- ]  ~- o" z5 A      }
7 l7 M8 d- ]$ y5 @3 }   if (yDir == "down") {0 G1 X) r" q" }
      yPos = yPos + BallSpeed;/ v3 y0 v) w0 I, y) A: Y- |$ T3 x" s
      }
; P6 q* e' E5 O" a& r/ @6 w& O7 Q   else if (yDir == "up") {
8 ?' X0 H, g6 J      yPos = yPos - BallSpeed;
: m+ g0 f% N8 {6 y/ Y% ?( L% b      }
5 F+ |, X5 ]; N- n, r6 _   else {! y, U5 F- {8 `3 V9 C
      yPos = yPos;, f0 P, l8 m- ?2 W  v
      }
& f3 Z" M" Y" b  p$ b* r   }7 [: r; E" j: A
. U% w  q+ a$ j4 L. e  h1 O6 U
function hidetext(){
5 |3 w3 U( ~( \: J' Eif (document.all)
. d- i( d) N) ^; ^( @: F% c9 \supertext.style.visibility="hidden": r, [# J, c& C& _9 E" i
else if (document.layers)  {: r2 G" ~% ^( P
document.supertext.visibility="hide"* V2 g! N# i+ J3 c* \. \
clearTimeout(animatetext)3 t% n/ l( {" C+ P) S0 I
}
4 S  _/ b/ z) r
) t: r( a/ G. N/ z6 Z- D  I  `& Nif (document.all||document.layers){% @2 R- V$ k6 b. f4 y! C
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')1 y- g5 @* G# i& P
window.onload = initializeBall;
& d& M! ~9 _. ~8 P( rwindow.onresize = new Function("window.location.reload()");: L2 D# U6 w6 A% p1 D+ O
}
! y1 d( r0 n6 r+ u0 d- K( ]. x, c6 C# e0 N6 Q* t  S* d
</script>

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