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

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

<style type="text/css">" X0 h7 N# j+ Z
#supertext {
' Y8 Y( W8 Z; D$ Fposition:absolute;
! L) n; R) s  z. J1 H4 Z% ^left:0;! I- ]6 A# Y  K+ b
top:0;
+ v& E  ]: o- k6 K" E, C$ z' Z* }visibility:hide;; Y# `; t: `/ R0 }$ o, ^: O
visibility:hidden;
0 L$ f5 D. h) |& t( U" m% N}9 \! w1 W% H+ ^1 x% @+ D" l3 w2 Z
</style>
8 f* f* x9 ]( q" I( ]/ _3 V<script language="JavaScript1.2">: L5 t4 k5 U! s3 N4 W
<!-- 改变下的字体的大小。颜色-->2 b; X0 P. U+ [
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'! x; H$ I, k/ ^4 I
var hidetimer='';. F7 h' e5 x- j3 p2 `
<!-- 改变下的弹跳速度-->" p. a2 s, y! ~" ~$ g. ?5 v9 ?' E4 H2 h! u
var BallSpeed = 20;
1 P  y% J+ b& ovar contentWidth;
$ {( f0 j5 x/ b( V" Avar contentHeight;
3 C* L0 Z: }- H4 M! g, Tvar maxBallSpeed = 50;
+ u7 Q6 N9 l* r+ f' y$ G; s5 B: z" `8 x3 h  V: r# Y5 n

' W) Y# L/ n  _. v9 ^# }var xMax;" z1 x0 t, ]5 N2 a9 \; I2 D/ W7 {
var yMax;
" a% `: a1 v. g1 Y0 ~3 [3 R, Xvar xPos = 0;! q" Y4 H3 G3 {2 h6 ~! S
var yPos = 0;
8 K4 O8 C/ n( K) q6 O  V9 ]$ v# xvar xDir = 'right';; e1 |! y  p; ?+ b$ ^
var yDir = 'down';
1 s3 V7 j% F/ G- Z) @var superballRunning = true;" h$ p* N  {2 K
var tempBallSpeed;3 k6 F. y$ {+ W% l
var currentBallSrc;
3 H: ?* L% E: y' a# Mvar newXDir;
$ R+ s+ k( t6 F$ Wvar newYDir;' ?' z( H2 S0 b$ V: `& C! @' F
2 M7 C) J7 `- j' N3 v/ r  Z3 f
function initializeBall() {9 c4 l2 x  |5 d$ E$ z5 v: r6 H
   if (document.all) {
/ N" t* J) S2 M/ ?; \) ]& n6 H6 U      xMax = document.body.clientWidth
! h8 k& W' ^" C  f0 j      yMax = document.body.clientHeight. p/ }' C( G/ e9 n7 d
      document.all("supertext").style.visibility = "visible";( ^# \% {: l. m/ W
      contentWidth=supertext.offsetWidth
% V2 B, c" E6 Z% C$ \0 Z      contentHeight=supertext.offsetHeight
- }9 u& t# `' ?5 M      }# T! x! y7 s9 R' w$ [. i7 k9 N& k
   else if (document.layers) {% ], A7 u9 k$ |; L* \. i
      xMax = window.innerWidth;* I, k( F: B8 L# @* h$ J
      yMax = window.innerHeight;
0 D0 ?& L" e; k0 r/ m      contentWidth=document.supertext.document.width
9 N* b8 O: T: i4 [" u, }      contentHeight=document.supertext.document.height' d' z( J- a# Q7 N" V1 G
      document.layers["supertext"].visibility = "show";
$ W) x/ M" h$ s' s      }
- l# q+ k& b4 J7 |9 w; z   setTimeout('moveBall()',400);$ f( Q0 }& Q( U8 P5 d
   if (hidetimer!='')
9 }; |' C/ H/ @$ |4 i9 c   setTimeout("hidetext()",hidetimer)9 W4 \  ^5 R. a
   }& N/ t; m( Y) x5 F4 V. E

2 Q& c% v! e/ {3 J  F. cfunction moveBall() {
! U2 D, e9 m3 P6 d- i& l   if (superballRunning == true) {
# t4 z" K, i0 X5 O: g% z      calculatePosition();7 r6 T8 {  ?' l8 \0 W
      if (document.all) {8 _# ^: j  G2 K6 p+ T4 f7 y* Z, H8 |
         document.all("supertext").style.left = xPos + document.body.scrollLeft;  w- d' f/ d" ]
         document.all("supertext").style.top = yPos + document.body.scrollTop;% M$ M  E' B" L( m" z/ ]
         }
) n# c. y- n3 y$ N      else if (document.layers) {
( |9 A+ a2 ]6 e/ c         document.layers["supertext"].left = xPos + pageXOffset;  F3 `$ d- D7 o$ b4 q
         document.layers["supertext"].top = yPos + pageYOffset;
- W, Y% q/ p5 N& M         }
7 q( ^% n9 I- H; J: U8 i9 t9 k7 Z      animatetext=setTimeout('moveBall()',20);! J2 z0 b9 m' ?% B6 A( Q
      }
- K5 V4 K$ R; R; h   }
2 c/ W: z  Z; B% _, z: D$ P
7 g( ]0 |3 ]# w7 K/ mfunction calculatePosition() {& b' U& X1 @4 }
   if (xDir == "right") {8 }' Y( ?) b( r
      if (xPos > (xMax - contentWidth - BallSpeed)) {+ A! g, p+ ?, Q! Z3 H% f$ m
         xDir = "left";$ A* g  Q7 i9 y. n
         }
/ c1 Q. Y8 F, e+ @      }+ Y! K$ T) |: @7 i' U4 o5 N) b
   else if (xDir == "left") {$ s" K2 ~8 S; O4 p1 `
      if (xPos < (0 + BallSpeed)) {
- t" _* Q6 S5 B; u; j0 l9 ~3 S! ?         xDir = "right";
& P" t1 W/ R. W) H. v         }
2 O2 Q# H# {# |, ^& O5 s! X      }& |+ Y8 o1 k& p# D; i9 d. [
   if (yDir == "down") {
7 K1 l) }9 O' ?; U: j      if (yPos > (yMax - contentHeight - BallSpeed)) {5 U( }7 R2 I6 }$ c
         yDir = "up";0 i" f4 I3 ^7 U
         }7 E4 F# N& H' f6 _$ v  \8 a5 E
      }
. g1 l& _, a, X& z7 ]   else if (yDir == "up") {
  `6 h, G+ g2 X* O$ {      if (yPos < (0 + BallSpeed)) {
* _% |% c! n. r: ~, c         yDir = "down";2 p; l8 v# `! A' }% K
         }
' {" K! U6 N2 N      }2 a1 d# r& I8 x, M
   if (xDir == "right") {% w% N0 {* `0 S7 {1 z& u: x
      xPos = xPos + BallSpeed;
8 s* k! ?: [" w4 N% X+ s' f      }
' g0 h) q- Q# h7 p# ]. ?   else if (xDir == "left") {* q- [& L! T- A0 N/ _- W. w7 u, I
      xPos = xPos - BallSpeed;1 b! k1 Z3 V4 w, a. f( i( a! f8 x
      }5 s* E, u# ?$ L; h# X  H+ `4 X2 b6 e" z
   else {% d1 _6 `  |6 F* D$ ?8 j
      xPos = xPos;  Z' _! F+ N. N0 \: b3 Y
      }+ e2 D6 Q/ V) J$ v! {/ N
   if (yDir == "down") {/ Q7 D4 r" R) |$ E+ t) ~6 ^' J
      yPos = yPos + BallSpeed;
8 K+ M( u  Z' j6 w$ r# N0 |; w* r      }' C0 v" g  [: l8 n
   else if (yDir == "up") {1 o# Q* x9 d6 s. v9 O# q: B
      yPos = yPos - BallSpeed;
" S5 L( z, \1 f" q      }6 k' o! o& x, y  Y1 ~
   else {
+ F5 w& O7 y4 B3 u' B7 G# S6 z      yPos = yPos;9 J5 |! o- k9 G7 ~5 _8 O& x7 d
      }
3 A" Q, b  ^1 z, f6 Z3 e   }
0 k1 a( g) \; R- _( y
. H( N& I8 e+ W) o, c0 ?function hidetext(){5 M2 v) [2 r, X. T
if (document.all)
5 _/ p) W  _" |. w4 g, Wsupertext.style.visibility="hidden"4 s0 n  H3 A- q8 B0 c4 ]( G# T
else if (document.layers)
. }! E" r8 |# z/ Hdocument.supertext.visibility="hide"1 C7 h5 w9 p+ n- c! {) s" B
clearTimeout(animatetext)
4 d& {, X# o8 e+ O: c}
1 N, O1 ]: r) v& N' B0 k, N  _# z( n& b' B9 `5 }/ p
if (document.all||document.layers){8 X. s$ e, m4 y- l% }# {
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')" z/ }5 p9 z8 o
window.onload = initializeBall;
* ]. i" J# S. q( q7 ewindow.onresize = new Function("window.location.reload()");
, [. o* n1 {5 C) F}
3 Q- h& V! l6 s0 D/ f$ h
  w* @5 H0 Z* T! q+ [; X</script>

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