返回列表 发帖

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

<style type="text/css">
  `' I' d0 I6 }- q" D#supertext {
# S! G6 f' F: H0 Wposition:absolute;( n4 {* ^7 `  g3 c0 t7 y) E3 m
left:0;' a& P" D+ |' k1 }2 C
top:0;' y  g+ n- Y5 X
visibility:hide;
5 K: e% {: M' n" O- dvisibility:hidden;1 A1 a4 b0 M5 k% V$ q8 }, Y
}3 ~9 J# k# U) O( W, H$ w
</style>) _- J& j% x8 l( f, t- U; R$ ^
<script language="JavaScript1.2">. q; B" G5 z2 ], L
<!-- 改变下的字体的大小。颜色-->
; i8 a( Y8 |$ x, H% X2 `3 fvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'! F  N4 n6 e- j$ J8 }' |
var hidetimer='';
$ j# |( k6 o3 C# b3 h<!-- 改变下的弹跳速度-->) F* e# w  E% @; C' {
var BallSpeed = 20;
0 ?+ o' C5 {' `+ _" Hvar contentWidth;: d# C! u, W6 B. k& g9 q1 i
var contentHeight;
7 M* f0 P5 J1 O3 ]1 P9 K/ R: dvar maxBallSpeed = 50;4 ?7 V- ^- Y# z6 z; g; K

1 v- P# G" @! O; n+ W/ ?( p3 d, M8 n6 p1 s! U, V# I! b
var xMax;
1 V1 o, e  R8 S' D" Bvar yMax;
* r& I0 T  }8 E- F  nvar xPos = 0;
$ j6 P8 \/ H/ T+ n7 Dvar yPos = 0;! O( B- B' e" ?! l# L9 g
var xDir = 'right';$ W. R% x5 a1 r: M- s  U) O7 ~
var yDir = 'down';0 A( K7 o; W& x! H7 P0 s
var superballRunning = true;2 I4 F# t- [8 W- [1 _, Z
var tempBallSpeed;' D# Y" A: F0 g! R: ?2 e9 U: S& s0 ]
var currentBallSrc;7 l& f8 p  |" }% ~
var newXDir;
0 X* C. R  U. q1 dvar newYDir;7 T# n+ T+ ~) u, j3 O" u( ~; b
! r+ d. ]2 f, J/ R/ N7 y6 p% B5 X
function initializeBall() {9 |& o* |3 M: ?/ e2 q+ B1 c8 U
   if (document.all) {
" X! D7 O+ J, d9 s9 b/ M      xMax = document.body.clientWidth
3 P8 Q% L" ~6 N1 U      yMax = document.body.clientHeight
, b) q+ U- D: E7 L! W2 W" X1 s      document.all("supertext").style.visibility = "visible";% |9 D+ T) N" S+ _8 s' @3 T& m; W
      contentWidth=supertext.offsetWidth
8 b0 [- [1 B6 @1 h6 x! C& f      contentHeight=supertext.offsetHeight
3 P/ Q/ a+ ^7 c; Y8 H      }
6 i1 ^5 L) E9 T( ~2 s- ^* j& D   else if (document.layers) {
6 S- k: y: C3 E. S* ~      xMax = window.innerWidth;' z4 K3 M. I" Y- g+ k3 b$ u
      yMax = window.innerHeight;
* X6 E- g9 z7 x' g" \: |      contentWidth=document.supertext.document.width% ]4 L4 }% E: k# a, G4 Y* Z
      contentHeight=document.supertext.document.height2 F2 u$ m9 R1 f4 _$ @* G0 l: u! T
      document.layers["supertext"].visibility = "show";+ U4 r2 h4 P1 ^# \; S+ M/ B
      }- |  J/ }3 u! P! u& R) ~$ A7 J- J
   setTimeout('moveBall()',400);! e) q; D( D" x" v
   if (hidetimer!=''); W4 ~/ J3 d& N3 C
   setTimeout("hidetext()",hidetimer)% R5 |8 r1 q" [1 u6 w# M. p
   }0 X& I5 J* o/ g; x4 k1 w) q

6 S' b7 W$ F" x* _, Ofunction moveBall() {
. m; n4 P. G; P! Y; n& g   if (superballRunning == true) {1 X( _  M# Z, e! K
      calculatePosition();! s* c: S* N0 j' Q1 ]
      if (document.all) {
' F" T' {+ G8 w* u: _         document.all("supertext").style.left = xPos + document.body.scrollLeft;
2 t0 T6 z) W. T) z" I+ h; B         document.all("supertext").style.top = yPos + document.body.scrollTop;# A- n& t( _. J! d5 m* ]
         }
( L9 v) m& ^& z- c3 G, l4 Z( Q2 K; ]      else if (document.layers) {
3 O" @/ |' D' H- y7 s0 X$ w& a         document.layers["supertext"].left = xPos + pageXOffset;) Q- H" Y8 L+ a
         document.layers["supertext"].top = yPos + pageYOffset;  \& S( J5 M6 \. n- t. r/ f8 S
         }/ g4 Z4 a1 ~/ O) h8 \3 s
      animatetext=setTimeout('moveBall()',20);1 C6 u& t! D8 H5 W
      }4 g+ K% X5 o  s+ _! H$ Z3 n9 C
   }
- X& }" S2 T$ B% s' Y
2 f' l1 X$ t# gfunction calculatePosition() {4 g" Y: _; N$ {& \$ H# o4 }
   if (xDir == "right") {
# V/ r6 _7 T4 D' h4 ^4 z      if (xPos > (xMax - contentWidth - BallSpeed)) {
% k& h" M% @" Q! Z1 ~         xDir = "left";
8 B0 G3 K, L8 s' M- L         }
4 ^5 j- U8 ^. e      }
4 w3 m' A7 Q4 Q! \. ?   else if (xDir == "left") {$ d: b( a1 e4 M* ~, b
      if (xPos < (0 + BallSpeed)) {% Y9 |3 r, t! l' f
         xDir = "right";
2 P  H0 o" a& ]         }
1 D' R( o. q9 E; m3 v( U0 D5 r( ]      }
& j0 w) g3 \1 |7 w( J$ R+ s   if (yDir == "down") {/ u3 c& \- S: M2 N( G
      if (yPos > (yMax - contentHeight - BallSpeed)) {
0 Z& J1 U7 ^; }2 \" G1 [3 K3 v: H         yDir = "up";
7 g& o- g5 |/ M! e; [( H4 x         }7 N- z! Q: `" e, x$ n* g/ f# X
      }
. d2 z( [& L1 F+ Z5 y# P& L) \: \   else if (yDir == "up") {7 ]/ o$ M) f; O0 w. Q/ k" s
      if (yPos < (0 + BallSpeed)) {8 Q, J, a" z. \8 X$ ~4 f8 `5 ?0 @
         yDir = "down";
1 V' D: R: P) B- A         }6 w, x* y9 p& o1 k+ A, s! C3 l2 l+ n
      }
7 D9 A% V6 n5 j! ?   if (xDir == "right") {
2 N# B6 S, z+ j* V9 Q      xPos = xPos + BallSpeed;' s& v8 R, T$ J) _0 u  ^) ~0 Y0 W
      }
: j& [1 H: U+ Y$ L4 ]6 b   else if (xDir == "left") {1 C$ G2 k, _3 h# ^9 e
      xPos = xPos - BallSpeed;
7 r( F' C- s- S1 M  G      }
- q+ o0 Z5 ]; A   else {# V1 C- I) ]) N0 p) F. j8 a1 v
      xPos = xPos;
( c$ p0 O% s4 ]/ K      }
! b: a  E" w3 w9 R+ J2 ~( {   if (yDir == "down") {- Z* s# u! q2 ~$ a: n
      yPos = yPos + BallSpeed;( n5 O% v( [( ^$ a( H. m3 d( V
      }. |. h! o" Z8 w6 ]7 n3 d8 V$ T
   else if (yDir == "up") {( g: Q% L* H$ ^
      yPos = yPos - BallSpeed;8 v3 }! u3 {7 A: `9 A( k
      }
# j; y) S. b6 V9 I+ x0 B/ O   else {
! ^* _8 ]9 |7 V2 c1 k" e& w0 L      yPos = yPos;% J$ ^( w/ Y5 y" Y) g. P, n3 M
      }8 J7 R/ U( ~9 {9 N! o7 K8 v
   }9 X0 ?5 k/ o# c/ K/ \' P2 S
4 g5 ^& y* y  s1 G% p; }. D, t6 {
function hidetext(){! |* a" t, g! s6 a
if (document.all)
1 @+ ^9 E, d( `: Y5 q, dsupertext.style.visibility="hidden"
% n, E' j# i- f; Y# m/ P( R8 Belse if (document.layers)! ^( _3 c! R. q
document.supertext.visibility="hide"
/ R: b: R  w7 {& q. T8 n: [clearTimeout(animatetext)
  K2 s$ z2 s( f9 k5 X- d/ X/ g+ ]}
( N( u( x+ {: F3 \: ]0 X' g- d. g  ^  o
if (document.all||document.layers){
7 A6 Q- {/ \/ |. J1 |% ~  T3 K+ e) odocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
: M4 j; C% _7 @& q) F: Vwindow.onload = initializeBall;
+ f, _0 N, F% @window.onresize = new Function("window.location.reload()");
; w2 z8 ?. ]* T}
; L, k9 N9 Y# o, G8 A
- [9 E& J+ l  G) q$ |" r: |5 n) l</script>

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