返回列表 发帖

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

<style type="text/css">, U' i1 K1 d3 S4 v" B: `, k% ]
#supertext {
0 ~8 C4 O! p( d- c) l: lposition:absolute;
3 P3 P2 s+ O) z# ?2 K0 O( eleft:0;
: _# g, p; V" _6 y  m0 t& Stop:0;
# x, b- S4 a) }* a2 X7 q1 v7 U+ A  Rvisibility:hide;, d: f; ^& T" W# V
visibility:hidden;/ y5 c* `2 o1 I: }4 S$ s
}! P7 n+ Y0 v) m: R  d1 P
</style>2 Y. z8 }6 G1 V
<script language="JavaScript1.2">) N4 J2 g8 `4 G- U7 K: G/ P
<!-- 改变下的字体的大小。颜色-->
4 A/ F0 H8 ^9 [) Tvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'$ a0 B. R* d6 h2 P5 E
var hidetimer='';
. |7 S* W- i5 }+ j1 }; u2 N<!-- 改变下的弹跳速度-->/ A! z  J4 X  w! S  Y' f, l
var BallSpeed = 20;
, o' k1 D5 M) E1 F( g# Wvar contentWidth;
8 e' _5 }+ m* R3 w( d9 _* _1 rvar contentHeight;% ]3 B# L2 W/ ?$ p! u1 w
var maxBallSpeed = 50;
7 j! b, k) c" ^1 Y* F" U( ?
: a) p9 {# P6 ~  r
9 N1 m1 Y* ~# ?8 }# `var xMax;6 {. G4 g& _) i7 B9 b/ _# r
var yMax;. |* a- T( O+ j$ Y8 d, d
var xPos = 0;
# ~0 }7 d2 _1 Q( K  Bvar yPos = 0;+ N$ M/ S7 \3 K5 b+ q
var xDir = 'right';6 C, [% K/ V# P% j. J, e, g
var yDir = 'down';  W' A+ D( x( I5 E
var superballRunning = true;# t& H  X, m2 E, r  o* X7 |# X& x
var tempBallSpeed;
4 o4 c( {/ j0 z) \- O0 \var currentBallSrc;# ]2 n. ^$ M: S3 h5 b+ g
var newXDir;
8 O# z6 ]! w! Xvar newYDir;
- ?. T5 @- l& R6 w, U: Z
2 q; v$ J" J" K0 ^% U6 ^- Hfunction initializeBall() {
& y" P+ T, m. P7 M( c; j! Q   if (document.all) {. u) E+ \! b9 |7 w2 s
      xMax = document.body.clientWidth
* E" x( E0 L3 |) r$ O$ F      yMax = document.body.clientHeight
+ ~/ P- @2 S* M      document.all("supertext").style.visibility = "visible";
# x' M: C3 o0 L) S      contentWidth=supertext.offsetWidth
1 J8 g" u- H' U6 F, q/ I      contentHeight=supertext.offsetHeight$ G/ e6 Z2 O8 _! Y5 R6 c
      }& \: y$ @) ^( m- p9 v
   else if (document.layers) {& V, z" a7 k5 e) B/ y9 s8 P' G8 u' J
      xMax = window.innerWidth;" Z. y: A$ n1 N8 x3 y  J6 s
      yMax = window.innerHeight;5 o7 J* |, ?/ E" P
      contentWidth=document.supertext.document.width$ n* Z( `5 S4 Y9 o* q8 I6 x8 z
      contentHeight=document.supertext.document.height
: P% ^8 Z; C8 w7 J" r      document.layers["supertext"].visibility = "show";
+ J6 C6 {2 K' z+ E      }
% [" x  W! ~/ @: j, Z# s, P  z   setTimeout('moveBall()',400);% A$ s1 N) P* L& C# s6 g7 ?* W6 \
   if (hidetimer!='')- {. c  ~( \0 @( g/ w; d9 a
   setTimeout("hidetext()",hidetimer)
" r3 ^! v/ J- J8 q   }' O- X2 V* Q1 E9 k$ R. e
  Q" c) O( Z: E$ A& P1 E9 d
function moveBall() {; |  W2 F: t( Y7 E
   if (superballRunning == true) {! }/ D  H  [4 p
      calculatePosition();
% m  I3 k1 r7 V      if (document.all) {
! E; L7 D, r1 @) s         document.all("supertext").style.left = xPos + document.body.scrollLeft;) i; d8 R0 W4 V0 w1 `1 d
         document.all("supertext").style.top = yPos + document.body.scrollTop;
! t8 V; k8 l- A* D         }
- L( I7 H+ K6 h9 ~+ p% Z: a      else if (document.layers) {
, n8 m1 c9 e  K' l: s% M/ C         document.layers["supertext"].left = xPos + pageXOffset;7 B" o& s, A6 D) l) n/ E- r; n1 K
         document.layers["supertext"].top = yPos + pageYOffset;( F5 _, \0 q: p3 V
         }
5 K: c7 ~) [# D  n' o6 i& N      animatetext=setTimeout('moveBall()',20);
# [" z$ i/ t. r+ z: i5 F      }
6 O3 [, K1 ]# F+ |/ N   }, q6 X/ j9 r$ [  C5 |
2 r- l* r& r% N- }' A
function calculatePosition() {
8 k) m" B. g- {9 P3 a" ?   if (xDir == "right") {9 y  t+ G. S4 n+ Z9 q9 j; B
      if (xPos > (xMax - contentWidth - BallSpeed)) {$ f5 Q/ n. X9 k& R' R. R
         xDir = "left";
$ ?1 M0 R& {' G' ?! e         }$ S' v5 |. `2 v' a0 Q
      }
+ i1 Y' ~' i# M" o+ \+ ]4 {   else if (xDir == "left") {/ d1 G! Z/ z% X! v6 i: c
      if (xPos < (0 + BallSpeed)) {' Y4 P. x. @) h0 x9 y, T- z' W
         xDir = "right";+ V% R' e0 f) J8 C! X
         }
, q& t4 @3 W/ ~      }/ b% }1 ^$ a% d/ W, L- g) p; h
   if (yDir == "down") {' y$ i( v6 @  J- r  k+ @) F/ i& h
      if (yPos > (yMax - contentHeight - BallSpeed)) {
- c4 ?  h% f- l& g: J  {5 w         yDir = "up";
' j* a1 B" ~/ X& z2 r! ~         }7 @; h$ P, Z9 M* c, I
      }* X) v! W1 T( R; z' k
   else if (yDir == "up") {2 ~) m$ k; O/ ?% o! `. T
      if (yPos < (0 + BallSpeed)) {
. w7 K/ X2 t$ X" X( j         yDir = "down";
& w) h# K6 Z; m3 w7 a' R         }
# @- d9 W" O6 ~2 Q; M! h: f      }
  E3 k% J  s8 a2 m1 u0 U   if (xDir == "right") {
! r. q0 X% X& u$ H5 Y      xPos = xPos + BallSpeed;1 N- b8 U9 A: l2 f4 H
      }$ D9 H/ o4 S' Q' [5 l* X& {
   else if (xDir == "left") {
# ?/ W* c9 u$ F% |1 n      xPos = xPos - BallSpeed;5 [. S# b$ @  q/ P9 p9 _& w
      }
# D4 p8 _% t5 {4 w6 I3 M# J   else {# [" N( s% r1 {7 {( p& B
      xPos = xPos;% t( {% B" W) e3 \7 ^
      }/ [! F" I  K7 l0 E
   if (yDir == "down") {" U2 ?- {0 h- O) \
      yPos = yPos + BallSpeed;2 k0 G# X( ]/ V9 ^% F+ ^
      }
1 l' E7 D6 G, c/ v   else if (yDir == "up") {
' W( h" k) i7 z7 {2 c* b% j      yPos = yPos - BallSpeed;
( B- [% D  M# p8 `: n      }" Z- i! g( f0 s( N7 a
   else {/ _6 a5 r$ |6 W& O
      yPos = yPos;
8 f: G1 [! P0 s( k% R      }' H  J; P: H2 H7 O
   }
& C! r5 ~8 C6 A0 \4 B# T0 w+ K1 V+ b4 c
function hidetext(){
9 L- b0 l) a* l' k0 [if (document.all); h( \1 Y8 j) e! S+ b3 c0 p
supertext.style.visibility="hidden"% J2 _4 y. C5 Z. `$ F
else if (document.layers)
: |' }( |* L. {% Vdocument.supertext.visibility="hide", J0 z+ @: n3 Q
clearTimeout(animatetext)2 H  U! m! d5 l* W! X4 l
}
: `( O' S. m1 S* u5 W
1 W8 F6 h& \2 p  ~4 B) j3 m, K9 zif (document.all||document.layers){. }! Z7 x: H2 V# D7 K- {! a6 [
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')" f# \' L6 a8 o# _
window.onload = initializeBall;9 @3 C! q, {2 Z
window.onresize = new Function("window.location.reload()");
5 Y3 Q: L) z- R( G}8 m8 a! J$ ~" V: A* [3 k/ }- A- W! ^

  M0 {- I. t0 H& Z, v</script>

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