返回列表 发帖

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

<style type="text/css">
8 j! X& e/ c$ _, f% U* W. o#supertext {
2 ^( U5 `! W% c6 }3 F$ x7 Oposition:absolute;
$ J& q6 `# p/ y5 h" `. {# Lleft:0;
& y( w$ d0 W2 v/ Y1 otop:0;
& Q; y- i9 N( _& Gvisibility:hide;3 @6 }- t$ A4 S+ \% J5 U2 y3 f
visibility:hidden;6 v, T) S' J4 ^! l2 `1 U+ n8 }
}
0 d' ^- {$ `: c& z/ d</style>
+ e1 ]6 t9 J3 T4 j7 M<script language="JavaScript1.2">
, [; H7 V; D/ }$ F/ Y! t0 E<!-- 改变下的字体的大小。颜色-->
% f' K/ Y9 r3 o, F; |1 ]var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>': b2 |' `7 y0 [# \3 M
var hidetimer='';, Y" r- ~' b6 R
<!-- 改变下的弹跳速度-->3 K* P$ {8 ^1 P& ~: @2 K2 U
var BallSpeed = 20;
$ g) O4 a* o& j* H8 zvar contentWidth;
& W0 u3 n4 w, D' H# z/ u& v/ l5 Mvar contentHeight;/ q: l1 _" W8 {" F" d
var maxBallSpeed = 50;- E+ v% T7 ]& k1 H0 n& v

5 _, Y  w+ j1 N- ]! H
/ T  Q. b$ |, X2 D  U( z) d" ^var xMax;
* Z$ i6 }, @  g7 E9 n# u6 c3 @+ Wvar yMax;0 i. v2 p3 X0 c5 b% p
var xPos = 0;
1 x" M* d% `) u9 j3 R+ D6 cvar yPos = 0;
. n0 C* o- J1 Q& m: d0 K$ i( ivar xDir = 'right';
, Z) t% ?4 d; s& |' E& V8 _( Evar yDir = 'down';
% }4 W# D( p$ ?/ h" Z1 u7 tvar superballRunning = true;
# s9 T2 T/ e8 q! o/ O* S( v: Nvar tempBallSpeed;
( R  q: f' b9 z3 G, dvar currentBallSrc;
* I" k1 j3 L) t6 `var newXDir;
+ A& U9 b% B* [+ Bvar newYDir;
" T' M: A/ {5 `5 z# u; z- ^; q9 z( _
function initializeBall() {' ?5 L2 `4 _2 V$ M% c5 q5 i. Y
   if (document.all) {+ }+ J4 f# t% `' p4 s1 C( a
      xMax = document.body.clientWidth
  W+ h1 t% v. ~- j- I( D2 T      yMax = document.body.clientHeight% u9 p. ]8 t$ g
      document.all("supertext").style.visibility = "visible";
' u6 D# G! F# G8 h& n      contentWidth=supertext.offsetWidth" S$ {, {) ^. [0 }1 D, _; M$ F- \' ]
      contentHeight=supertext.offsetHeight: L; D9 W3 w. T
      }
8 k+ |8 o/ O. V* w7 a! M6 z   else if (document.layers) {
3 ]% A$ u+ u) w" [! u      xMax = window.innerWidth;1 i4 [/ x9 l& i  `. M/ G9 D( e
      yMax = window.innerHeight;
' \: i7 _9 u+ V# S      contentWidth=document.supertext.document.width
* J9 Q: H2 ]2 G      contentHeight=document.supertext.document.height' |0 |6 l3 \4 L" v- c
      document.layers["supertext"].visibility = "show";
' e) |, Z* e9 c; n; f0 d% P6 Y      }
4 q# [" J# B. s& U8 _3 R3 n( k" Y   setTimeout('moveBall()',400);
9 G8 o6 Q; z) a: a$ \9 l6 Z. c   if (hidetimer!='')
7 W4 n- ]9 E1 h) X: k$ @5 \0 ^) z! E+ L   setTimeout("hidetext()",hidetimer)4 h7 G4 \9 I, V9 c# _
   }' K& ?* H' _& O  i& f9 p& q+ X
9 z( n* A0 `, {) @4 r4 b! q6 ?
function moveBall() {; E# ^$ g* j+ x, M, {. Z: z# E/ h
   if (superballRunning == true) {
( ]* ]' f9 ]7 J4 ^% m% C! n      calculatePosition();" Z5 e& u! G; N5 V5 D+ g% K
      if (document.all) {% ^8 q' Q3 a# v+ a' o/ l. L5 p" F# c
         document.all("supertext").style.left = xPos + document.body.scrollLeft;. J: j6 _9 ^( `( ]8 j
         document.all("supertext").style.top = yPos + document.body.scrollTop;! J( c2 Q- E, G6 _
         }+ C* ]! @. d6 S' W) s8 ?: S$ l
      else if (document.layers) {
; h3 o7 H5 y+ `* f2 K         document.layers["supertext"].left = xPos + pageXOffset;* l6 w; G. I( T* L5 M
         document.layers["supertext"].top = yPos + pageYOffset;+ b& m, ?" ?2 g' \" K) b
         }' P* l" |/ W+ H' \& \# X
      animatetext=setTimeout('moveBall()',20);
# T( Z; B% G- n+ _6 n* W: ~$ p      }
4 v: X7 @/ k# F7 W0 \; a) W7 m   }
8 x/ O+ h6 Z0 d& y! F& U+ s' G: B" V2 \
function calculatePosition() {
1 R( ^) k1 Q7 z+ D: W4 S! Q5 H- P  @% f   if (xDir == "right") {& y  O9 k; Y6 h
      if (xPos > (xMax - contentWidth - BallSpeed)) {
% \+ c! V" l2 Y8 M. w$ C- g         xDir = "left";
, Q, s# e* W7 ~4 G         }
# C/ p7 {; B) ?1 F' z  n3 J5 w  r      }% w7 k) p7 d* S1 r
   else if (xDir == "left") {, v7 O# e7 _7 h
      if (xPos < (0 + BallSpeed)) {" M' }' _4 s! I( }( @( ~
         xDir = "right";. {' a0 N9 H, w; J4 \' A
         }: J. M- p8 N' P& f9 p/ z
      }
% R0 Z& e- `) Q, Z5 j6 U   if (yDir == "down") {' W0 }- p4 L6 R; A
      if (yPos > (yMax - contentHeight - BallSpeed)) {
" W- x& |6 Z6 G3 }! j         yDir = "up";
) L9 y3 C- ^+ v' H( O         }
2 z- l' E0 I; l9 s      }. L! {+ k( M6 ~5 [" H& N& o
   else if (yDir == "up") {
- ^: P$ E0 S1 @7 _- x: u. Z6 {6 w      if (yPos < (0 + BallSpeed)) {% J" c: k- @: U& S, C+ a/ x. k
         yDir = "down";
# [1 I) b: x! ]         }
% |- R5 I3 T8 S( o" Z7 k      }! i& d$ S  U$ t5 g+ S4 @- G) R
   if (xDir == "right") {
7 ]5 [9 }) a% H, t" |( n5 y/ s1 y$ s      xPos = xPos + BallSpeed;
! w$ i5 x9 `9 K% Y      }2 n  U, }4 e' {+ E! L2 S4 Y5 e9 e
   else if (xDir == "left") {
; C. N- B- y3 ?! K* G( [3 \* ~      xPos = xPos - BallSpeed;% C: I3 K" H: a) e
      }3 @7 h5 Q' m; D. f
   else {( @* @4 ]8 R1 I
      xPos = xPos;7 W( U; F3 `* R2 H" T
      }
; o" L4 M0 \( d; I, |   if (yDir == "down") {
% P# M# b% f/ ]+ l: S5 U      yPos = yPos + BallSpeed;
) n+ J# W2 k+ n" d/ a& n      }
7 c$ j; e9 H/ N# S% L# y   else if (yDir == "up") {0 q1 [3 X7 u" B* t& }1 o5 @2 T! i
      yPos = yPos - BallSpeed;
3 x5 x5 H5 ^$ l; S' |% p      }
9 d0 N$ h, V. z   else {6 ]* _2 b( G8 t& L' j/ A
      yPos = yPos;: ^, Q8 ], }4 _1 E: F
      }5 T5 N! }* [$ c
   }9 O4 ]+ P8 m9 C" V! I& D. l

: F/ ]9 n/ ?8 Z. ^function hidetext(){
6 c3 q! Z, c2 B3 u) l- U; ?if (document.all)
: _0 l8 |  X6 @  j0 Psupertext.style.visibility="hidden"
, i7 D- Y/ Z- m/ \# D% uelse if (document.layers)- n2 s4 y+ n$ A1 d
document.supertext.visibility="hide"
; U* C4 j0 M* I$ S: \. l( Y* VclearTimeout(animatetext)+ ^$ ?0 O6 t; B& Y! u
}
2 \; R: T4 C3 u, V9 R" ^, b0 m) Y+ g1 n: S5 |  d$ V5 X
if (document.all||document.layers){. p6 \$ n1 m* q- ?
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
4 O: q# T4 `3 z5 R1 ]$ _7 ~4 iwindow.onload = initializeBall;7 A1 p) T; k! R; l& Y
window.onresize = new Function("window.location.reload()");
. R* K9 ~. w. z2 L: ~) B}8 P5 G% S8 N" ]7 Z+ K# ^4 W
) a' P" O# e9 \$ j& F1 c
</script>

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