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

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

<style type="text/css">
5 f- h! t0 o( _" d#supertext {. e  F1 b) I  h6 n# X3 G
position:absolute;
5 S2 m8 k  Q; J5 v! Rleft:0;
& O& b: R5 S: m- Dtop:0;
+ N# O+ Y, l+ P) {- P: Rvisibility:hide;
; h0 u% t4 O3 F% ovisibility:hidden;1 q3 s* X5 u) m4 a  [9 {, e. z  R
}
5 l& x" U' u1 R</style>
5 T, p- u3 d  e& p/ `' c$ K* w$ |<script language="JavaScript1.2">
! k; Y5 V2 H+ y; b4 X8 ^, A<!-- 改变下的字体的大小。颜色-->
+ \) ?' C* E. B7 o5 v  P, D* B( A* Avar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>', k0 k& v" b% ]9 d' Z8 B
var hidetimer='';
% {' x% ~4 N7 q2 Q<!-- 改变下的弹跳速度-->7 x" K0 N+ A4 n8 G: c
var BallSpeed = 20;
0 v$ ]# {6 h6 {3 C. s% Y% p7 l# }var contentWidth;
3 k3 o  t- e/ T3 ^; F1 b4 xvar contentHeight;  d) F9 v9 B  a
var maxBallSpeed = 50;4 I0 u% \* a! M) j" {  e" t

/ ]4 \8 C# F, b0 D2 G2 m- I- n  t  j) d# W0 w8 }# _: w: I
var xMax;
8 O; E5 K% p4 @& u0 b- svar yMax;: X$ {  P( d; C: H& q1 o
var xPos = 0;
  }/ t1 t7 W! H+ ^  A9 Jvar yPos = 0;
- h, e$ H3 f. J" D! m) _/ nvar xDir = 'right';0 q2 Y/ \% c  F6 G+ S# }
var yDir = 'down';; S1 g: e% X9 k
var superballRunning = true;
2 n. q0 a3 B. M6 _var tempBallSpeed;5 K5 B0 L; r/ F& r- l9 o" f& B- U
var currentBallSrc;; O, c2 l3 ^6 ?* s8 W4 M
var newXDir;
( Y! a5 e* t% M$ ^  j% s. fvar newYDir;/ o% u8 q: H: z

8 ^: n" l9 c' h- k3 U  [" |4 Ifunction initializeBall() {
! }7 d; B$ u7 F. Q. d! _, j  f   if (document.all) {
2 v6 O, u# h! Q. p2 @) V5 y: t      xMax = document.body.clientWidth4 b9 F$ R9 K" W; Y4 M3 |
      yMax = document.body.clientHeight/ ^. d& c1 f; |' a: t& }
      document.all("supertext").style.visibility = "visible";  k8 d+ G) W; o8 X4 Y
      contentWidth=supertext.offsetWidth* o: Z( D7 b7 v7 ?6 m8 q
      contentHeight=supertext.offsetHeight
/ b3 q4 C9 `& o+ K  [      }
0 J" r) N7 o4 A. ?. B2 y: l8 D   else if (document.layers) {0 g6 _2 u( N9 H
      xMax = window.innerWidth;
* \8 D. O8 u& b" z% w      yMax = window.innerHeight;
, H; @# j  R5 F, \      contentWidth=document.supertext.document.width$ u6 H/ I# o- w% j* e4 f/ }: |
      contentHeight=document.supertext.document.height
3 P* f4 ]' Y) O( s      document.layers["supertext"].visibility = "show";' L+ A0 ^8 X# r9 C
      }3 I* @( c7 V; ?+ A) O
   setTimeout('moveBall()',400);$ n2 A; [' ^3 |6 U
   if (hidetimer!='')3 j; }7 K; U' x7 f: u
   setTimeout("hidetext()",hidetimer)1 E1 q2 h4 g0 y& v, t' n
   }
* Q& K2 X8 s# n; {& _; Y5 ?, x. Z& [8 v4 `$ B
function moveBall() {& B; g0 x% E, f. y
   if (superballRunning == true) {; T+ B8 {+ n9 G3 b2 H. J1 x/ @: L6 j
      calculatePosition();
# G9 u4 x9 Q; `1 F: A      if (document.all) {9 N0 F& \% a* y. w4 S
         document.all("supertext").style.left = xPos + document.body.scrollLeft;2 Y7 t# c0 Z) }- C
         document.all("supertext").style.top = yPos + document.body.scrollTop;
0 x$ E: T9 c4 T. Q" f         }/ d" T: ^$ z/ P% b3 R' x4 a
      else if (document.layers) {4 W) p- @# d3 W0 `8 s' E) _
         document.layers["supertext"].left = xPos + pageXOffset;. d( p4 a* J  y) |
         document.layers["supertext"].top = yPos + pageYOffset;
( M1 I2 x* q; f6 S         }* o. i5 V; m2 b7 L; ~
      animatetext=setTimeout('moveBall()',20);
& u8 t5 Y/ L, r" p) G) c      }! {* |3 y" G# t0 q
   }
# w" H) v4 e/ s& O! K; \& |9 Y! s* Q% d# ^
function calculatePosition() {* `  h7 O1 F1 U# W: [& q
   if (xDir == "right") {& H( s. d  ?5 ~- O# c9 d6 I* `" {7 w$ D
      if (xPos > (xMax - contentWidth - BallSpeed)) {0 \/ _, G9 ^$ {- x2 b* ?
         xDir = "left";- e! V7 B! r- D% g7 B
         }+ G4 `2 p; R. U) h  \8 L2 G
      }
; V2 R% t: ]0 f  L( M   else if (xDir == "left") {# @, v# Y2 P" m: F2 N2 X$ T
      if (xPos < (0 + BallSpeed)) {  r! z# K& c& H
         xDir = "right";* x) g+ l9 L9 x6 l3 j4 p6 i% x
         }
( g4 P4 M, F; w& V- W/ O      }
4 U/ m* F+ S2 B! N4 D   if (yDir == "down") {
* C) @6 N* c" i" U' D. {& u      if (yPos > (yMax - contentHeight - BallSpeed)) {6 \( q- S) }. F
         yDir = "up";" W$ V" e/ ]$ Z0 R
         }
9 X" P  y6 K$ }2 s* \9 g+ B3 @      }
+ U" v/ A4 y$ I3 @9 p% a   else if (yDir == "up") {
1 d  d7 |3 A1 F& h; H      if (yPos < (0 + BallSpeed)) {
9 }9 O* ^1 T; w5 q4 y         yDir = "down";
3 |. U& R- Y: r% S  Y- U* _         }# o; t; D6 F) Y! n: y
      }
/ I3 x( g1 v7 Z" ?   if (xDir == "right") {& w2 g. p4 ~: [! t8 p" S0 T$ v- o+ S
      xPos = xPos + BallSpeed;5 o  \. z6 m# V  S
      }4 r6 l2 A& ]' c/ B
   else if (xDir == "left") {% \1 b+ C9 G8 U' t
      xPos = xPos - BallSpeed;
$ B$ n/ X3 O7 f9 n' u9 d1 @7 E      }
/ P9 K' ^& e5 p8 E6 x% ~* j+ E6 q   else {) v; S, @. S( I: y- {6 d
      xPos = xPos;1 Q; T+ R* G2 h. ?4 x9 X3 R
      }
# N- k# P* H1 i5 G) s. w4 f5 L   if (yDir == "down") {% q+ V; y9 ?" h9 \/ S4 R
      yPos = yPos + BallSpeed;
  |: m9 H- H, a. v- A      }
3 d5 h. G, p- U) d8 @2 W' {  X2 K   else if (yDir == "up") {* p  G5 ^, C8 W
      yPos = yPos - BallSpeed;. [0 c/ K& H0 _3 t+ o6 y
      }
  u4 m2 ^0 _% t! Y   else {
! \/ }& ^: f4 R      yPos = yPos;4 h5 D6 ^/ C: O& R$ [
      }. m$ e8 p" t8 M; Y: l
   }/ l, V& ?1 u; ?& w) _  C2 G
4 t, R- G9 F; y
function hidetext(){
3 q, I7 P( ]0 L1 W; O, G+ e8 `if (document.all)) f! |$ }4 Y' L6 {  \- W! Y
supertext.style.visibility="hidden": g. u+ F- b$ S8 T) ^
else if (document.layers), r/ x  Z1 y+ S
document.supertext.visibility="hide"$ {0 v' }2 W' B$ B* }3 M, k1 N
clearTimeout(animatetext)
9 ~4 f# ]8 p' i  a& k}
2 ]! [5 |) L, Q- m  C# G% O& Q; U# O
if (document.all||document.layers){2 b" ^" Q$ a, V; A4 _$ S4 K
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
0 v% B9 d, [; O: k2 twindow.onload = initializeBall;6 |) R6 z3 ^3 @  L3 K
window.onresize = new Function("window.location.reload()");
4 \- K/ D/ e7 C; F- ]- T}
. b& [, {9 P( n+ m  ^
" W& {5 o1 W4 @$ }# G$ n/ L* [</script>

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