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

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

<style type="text/css">
2 \8 i5 L: b8 g#supertext {3 l1 U" ~+ i- X+ o, W7 A
position:absolute;: r! _: ?) @; Z/ h
left:0;
& p" C- \5 f1 h3 A) I9 M' o5 L) ?top:0;
2 ~* z0 {' E3 |6 `) ?* ]& _visibility:hide;3 J7 U: T- X% g! p- `
visibility:hidden;/ B. \# n  Q8 e* n
}
. G1 {9 a$ J; b  ~3 v* I+ U9 Z</style>+ m+ l+ g+ L' @, i' f* ^
<script language="JavaScript1.2">: D, j$ Z  p7 C0 m4 f0 ]" [% Y
<!-- 改变下的字体的大小。颜色-->$ N! d9 r6 Z8 d1 s6 p( n4 l
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
9 P- Z8 `/ C! [7 h  T' Kvar hidetimer='';
+ D8 I7 W8 j5 O' ?: _% @<!-- 改变下的弹跳速度-->
5 v' B, f/ W6 f" yvar BallSpeed = 20;
: B5 K$ N, v: lvar contentWidth;" W; }" S' t8 |9 j, }+ R
var contentHeight;
! ~+ F5 v8 V& K- x; v/ j' mvar maxBallSpeed = 50;7 X7 e2 E, m, \# a) c+ u* a

7 F- a" h4 C" L4 L" p) [4 P' Q! F) H5 v% U9 i5 |7 _
var xMax;
. c; c' P* @2 @1 o  mvar yMax;
; r2 X; d5 _8 x3 {* kvar xPos = 0;! C3 N) f5 n9 E: v1 x7 U6 x; J7 n
var yPos = 0;
5 k$ ?& q& @: `5 b6 |5 Qvar xDir = 'right';+ c: [3 A! b) @( _, E$ Y8 {4 e
var yDir = 'down';3 ?5 O) H1 u* D) S( g( ]
var superballRunning = true;+ u. B  i# a) D- P- M8 t' ~+ B" o
var tempBallSpeed;8 t  B4 A5 L. m1 [, D3 i2 ]+ ?
var currentBallSrc;( T$ i% ]$ W  Q! m! ~1 U  l
var newXDir;4 Y3 u+ @4 I( f+ `* T
var newYDir;: N5 A# z2 O, A5 l
* ~& U) ~$ t4 I, g) K  [# S
function initializeBall() {, ]# D% N# o8 G3 V
   if (document.all) {' L( W! K& b7 c6 N7 A
      xMax = document.body.clientWidth
& Z9 B8 q2 q9 ]1 @. v5 u! T      yMax = document.body.clientHeight- X  J" C6 ~" e  {
      document.all("supertext").style.visibility = "visible";9 ?0 v' o& \1 m  C# i2 |" W# |7 T
      contentWidth=supertext.offsetWidth* r! [' w, C( i  U# u: c
      contentHeight=supertext.offsetHeight
) k4 g9 ~2 K; k3 N5 l( R& _+ N      }( l+ A+ n, o. S6 P* v; j$ }* h
   else if (document.layers) {" m' v: W, [; ~% c# u( ?
      xMax = window.innerWidth;
% b" Z& c3 z: F2 i. p- a& v      yMax = window.innerHeight;
" T0 r) T% v& F$ k  ^& E- C6 U      contentWidth=document.supertext.document.width! z4 D; Z; Z6 L8 }* b: |) `
      contentHeight=document.supertext.document.height
; y/ B. t4 L/ I2 A4 M3 p3 H5 N' Y" l      document.layers["supertext"].visibility = "show";
0 x2 E( P% }$ q8 O! ]  D* p      }& t6 P2 P7 D7 N0 @* c9 o
   setTimeout('moveBall()',400);; j5 D/ i, H% Z% y% P
   if (hidetimer!='')
# e0 Q( M& U5 P( r& \   setTimeout("hidetext()",hidetimer)2 M9 |1 @& z2 r
   }* `( n- y$ @3 M1 u1 T( G
+ B: ]4 w, F" D8 G: y7 [4 z. e/ I
function moveBall() {& ]6 v5 o$ k$ T4 e
   if (superballRunning == true) {& a7 O2 \4 w! ?5 `( V# f
      calculatePosition();
( o* y1 _" b$ f' v$ |7 E6 v5 J      if (document.all) {5 {/ L9 j; T8 C2 m6 ?. x: _
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
0 L; P: R5 ^. j3 ?. Z2 E9 D         document.all("supertext").style.top = yPos + document.body.scrollTop;
* u6 P7 F3 V2 y/ @# b* s# B         }
  d, a2 L. G! u# Y$ d% O9 f9 E      else if (document.layers) {9 |( T0 h& k$ H8 E2 a4 w
         document.layers["supertext"].left = xPos + pageXOffset;
' K  k, b1 U4 |         document.layers["supertext"].top = yPos + pageYOffset;  w3 F  D5 X& I. {8 L
         }9 K8 C: i- w9 y
      animatetext=setTimeout('moveBall()',20);
8 G8 g6 d; a( b. c      }
* \8 n  F3 {9 X3 \) X   }
+ l$ |" j1 t7 o' q5 p' K7 F1 @; U4 N7 n, g- C* X
function calculatePosition() {! K0 {7 u" q& V# i9 w. v' b9 E. w
   if (xDir == "right") {
# A: P% ~. K; G$ y: Y4 u; i1 M      if (xPos > (xMax - contentWidth - BallSpeed)) {
$ g4 T* T& m* T: K9 k         xDir = "left";; T* a% f% }& ?+ p# {
         }% h+ _& _3 h% y; H4 }
      }1 n. k* n5 y  T
   else if (xDir == "left") {* A: _$ i6 `( f% c) G* _- |
      if (xPos < (0 + BallSpeed)) {
+ U' d' y  i8 {5 D( h! V         xDir = "right";; y, j) ?9 y3 [  {& N6 d
         }8 @! Q) B! g& A" d9 Y* K8 M' Y5 \
      }
1 T5 M! a/ p2 I3 @, Y+ A. j   if (yDir == "down") {
: T, o: m: t/ p' U9 a      if (yPos > (yMax - contentHeight - BallSpeed)) {
' y5 b1 u9 w1 K$ f! W         yDir = "up";
! |; A$ G& p7 h" @  O* t2 S         }
! T; N- S8 [  x% E7 G6 u. O0 P8 S      }
9 _6 L- u6 [6 X) m   else if (yDir == "up") {! _7 I: m. ?1 m+ O
      if (yPos < (0 + BallSpeed)) {
, E  `4 B8 x* y         yDir = "down";7 O: ~. I4 k' K/ ?2 N$ v
         }
2 {: W" n) G9 x" D9 Q9 n! Y      }
" w) }( q) u5 T" ~2 ?6 u   if (xDir == "right") {( r6 U9 T& [4 [+ a7 T
      xPos = xPos + BallSpeed;
# I+ w1 C1 q' e0 z9 ?      }
. a) |0 V0 W; U" E; |' o/ S7 u! x8 G4 L   else if (xDir == "left") {
( U$ K# r- u7 T      xPos = xPos - BallSpeed;& S* s" e9 M' N7 W  y, s( g1 h+ x- ]
      }
/ c% c: n' g7 i# M$ m- I4 S& _   else {
2 y0 {) z8 i; F; R      xPos = xPos;
+ g% I: S2 [# G; |* K9 F+ J      }
( Y% W2 }) a" F! q3 t# H8 o) `( F   if (yDir == "down") {
' o: y* Q; f; @7 G2 b) I( Q      yPos = yPos + BallSpeed;. q- c% u) W+ a1 X- V# P6 N
      }8 m8 F/ E: S( A8 X/ u2 n
   else if (yDir == "up") {
" [( d( c4 T3 _      yPos = yPos - BallSpeed;
9 X6 [; @( ]* N+ v      }2 r0 W2 L6 Y7 X" z5 E
   else {
/ ^# G# P" A! h+ W% C$ w" k6 @6 _      yPos = yPos;
+ \) k7 {$ Y6 `# ~* o& d, ^      }+ A. |/ Q4 ~8 Q; f
   }
' X% D9 z, w. I/ Z8 I/ T
# \/ O8 r' T* y9 E7 l8 y. n' Q6 ~function hidetext(){, g! f$ d1 S) o+ R1 y( ]1 r) ^. B
if (document.all)
! j5 c' `% |6 Ssupertext.style.visibility="hidden"
& Y; h' W  U! S( N+ x: J/ K, Velse if (document.layers)
$ Z! K8 @2 j' P7 `# n6 a& Udocument.supertext.visibility="hide"* v, [  u! T2 P& v6 `6 V( \
clearTimeout(animatetext)) [( Q" U$ {$ v1 l: F0 ^- l$ a
}
! q$ O7 _- p5 A4 b
" q6 I( ?7 r+ Dif (document.all||document.layers){
* @& f8 W8 [2 ^7 hdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
6 B7 G! x  K2 ]. W6 j2 Qwindow.onload = initializeBall;" t4 K8 c4 p2 v6 m
window.onresize = new Function("window.location.reload()");
5 E% X* S8 f0 ]1 _) ]}
. R( U" h1 M0 ~" q) ?, s; m3 r1 g+ ?1 D* q0 R
</script>

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