返回列表 发帖

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

<style type="text/css">
2 G- [4 B1 O. \  p4 P- x2 V#supertext {
, D" Y3 `# ?* Q% N+ G: ?position:absolute;
# R; J" B) W! w+ O' {: f* ~left:0;8 K& j- t4 O" D6 t  b
top:0;
( d! O, U. K( i$ u. wvisibility:hide;5 T0 p# Z% r( T3 ~! D. v
visibility:hidden;$ V: e! g& |5 r& _. `+ T9 L$ [' m
}
  |7 I& P, k8 B6 k</style>+ ~1 Y# ]3 A9 c1 F6 i* K3 j: E
<script language="JavaScript1.2">& a  {/ J. I4 c
<!-- 改变下的字体的大小。颜色-->$ Q+ B' I6 o9 I
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
: b, j& J5 {# W4 J& evar hidetimer='';
% a: m/ H6 g- d8 U6 d- T<!-- 改变下的弹跳速度-->. ]+ C! c1 \7 Y" y
var BallSpeed = 20;
; y' _' r$ h6 k! z# T' N  z! ovar contentWidth;
. I8 X1 ]) y# Q" v5 U3 E4 g/ }var contentHeight;) f7 H  f6 P9 d( e2 c  |1 @1 B' g
var maxBallSpeed = 50;
# M+ a# T9 Q, t1 s, c2 p' Q0 e3 W! F* S, L

- ]! L! h5 O+ X6 D6 [var xMax;
9 f9 j7 y  e! P+ V  Avar yMax;! K8 v- O. L) \8 g% k8 k
var xPos = 0;
( p( r( n+ {$ Evar yPos = 0;
2 ?$ X/ K+ Z( q" S2 I0 ^/ Wvar xDir = 'right';- `/ C- A: f+ {" o
var yDir = 'down';
6 V/ X4 U1 d4 E/ \2 ~5 Q* a5 Ovar superballRunning = true;$ K6 @/ x2 m/ n$ P1 M
var tempBallSpeed;6 A& Q9 O2 u  H- C$ h/ l; }6 e
var currentBallSrc;
# _- z: X$ @4 K1 V6 Y( Vvar newXDir;$ \4 b$ U+ ?/ z4 W; ]4 ^
var newYDir;+ {, _: a6 ^# z  A
- V% m0 D% Q; z# F# Q4 w
function initializeBall() {- T, \8 _; x- _- z9 S/ ~6 ]
   if (document.all) {" p" {, a; k" n% j; O2 B
      xMax = document.body.clientWidth* L7 g7 o& |' _- S& }
      yMax = document.body.clientHeight( U4 Z- V8 A& H0 r) j& w
      document.all("supertext").style.visibility = "visible";: \2 [% s0 o, C. X2 e
      contentWidth=supertext.offsetWidth, i% w, g& G' h
      contentHeight=supertext.offsetHeight
* r7 R% {+ J! K' @# l      }
. t6 z# Y* z& r- j2 ~0 T: o   else if (document.layers) {/ w1 H$ {& ?6 g, y( l# }* I
      xMax = window.innerWidth;+ I4 ~% _) M$ R* D, |: B& P9 d
      yMax = window.innerHeight;- k$ t7 t9 N- R& H6 {; q
      contentWidth=document.supertext.document.width) ?3 A& W- w! {. t8 d' ?
      contentHeight=document.supertext.document.height0 l& E9 D' P- W7 O; K7 J' L, c: \, p9 r
      document.layers["supertext"].visibility = "show";
4 r- @3 Z% v4 x8 K6 w5 y      }; F2 U. ?) k8 H+ V/ N4 D
   setTimeout('moveBall()',400);. s. ~' J: s& O' ?1 m" H/ r
   if (hidetimer!=''), k& ^/ C% ^3 _: E# V
   setTimeout("hidetext()",hidetimer)# R2 |, m5 z, q6 f) G+ ~
   }
$ I$ E/ D% J$ |* v! @
: ^! U8 H$ N9 \+ }1 g" Ofunction moveBall() {
$ A" R" m  C& d- o: H   if (superballRunning == true) {
* \* K* f9 x/ Z2 L$ ]      calculatePosition();
# S1 G- [5 B; d2 i9 N9 c      if (document.all) {
# p# ?% o0 i+ H3 ^" W  s* N  l         document.all("supertext").style.left = xPos + document.body.scrollLeft;
6 G: M5 D0 R' p# d6 b- g         document.all("supertext").style.top = yPos + document.body.scrollTop;: |' i" J; w. k) [4 z5 X+ K; V* [
         }
0 s3 q; J% R: c4 z6 w      else if (document.layers) {
6 i+ T7 p# i9 B         document.layers["supertext"].left = xPos + pageXOffset;
9 o% D; S& S% E* O1 j3 Z& t: c         document.layers["supertext"].top = yPos + pageYOffset;- K& u% o9 @% b# F. }& {
         }! w7 \, G# c4 X4 |
      animatetext=setTimeout('moveBall()',20);
5 P  ^, l: J8 d8 P0 i4 u4 V2 C  S4 z      }9 U: {( G% i$ Z7 `, L: _
   }
9 \1 I! @% L9 V0 ~+ H$ b1 B9 V+ Z( Z( g& M( s3 ?( S2 j
function calculatePosition() {
/ M# _( ]$ N+ W$ ^3 B  H2 K8 l/ n   if (xDir == "right") {
: |  }" Q" n) ]6 r+ s& E      if (xPos > (xMax - contentWidth - BallSpeed)) {
# Q( |+ O, z# P. l2 d- t         xDir = "left";
) P$ o: |% Q, Y( N! T         }
. ^/ m7 q! t- r4 a* [* W6 p( P7 q      }
9 U: p/ }* G% X! f& ?7 B5 F) w4 o   else if (xDir == "left") {, A+ p$ o; w( `
      if (xPos < (0 + BallSpeed)) {
. a8 C7 h: t( E( [! M         xDir = "right";% ~) q5 i) K# t6 `/ T) Q
         }' m% z9 f1 O: @- S4 i' l
      }
; t% j8 j& M2 k& I' Z; D5 a/ Z; }   if (yDir == "down") {
1 W: {* e; ^7 V# G2 s% ]/ C      if (yPos > (yMax - contentHeight - BallSpeed)) {
+ ^1 \. X9 i9 W! M         yDir = "up";6 G) t, y! @; p. W( @% R
         }
, |) G2 L- I$ X! t( t      }
/ L0 I1 N( V; P! Y   else if (yDir == "up") {9 f, {6 B7 f3 ^+ j- d( x; z/ B9 G
      if (yPos < (0 + BallSpeed)) {' I, L5 e4 n8 j6 \
         yDir = "down";$ {% z& V) y4 D- P3 |6 m: ?# `
         }
. S; Q2 D  t6 p  ]9 @7 e/ p      }
& d4 ^$ P+ z3 W: I7 F- l   if (xDir == "right") {4 k. N2 G+ y4 T( \1 L3 E5 s, F+ L
      xPos = xPos + BallSpeed;
3 s  |3 d7 w6 A4 x- J      }0 N+ P5 I: g4 H; ?1 e
   else if (xDir == "left") {! v" }0 t5 X' _" B/ Y$ B7 F1 R+ z' o
      xPos = xPos - BallSpeed;" Z0 O8 Q9 s  a2 h% Y' T' A' O
      }
2 F9 G7 l: T7 \) X; w3 h7 X   else {
5 R/ Q- w: q7 u" A! X) B9 U      xPos = xPos;
4 w; u- k! o, Y0 H9 W      }( ~$ F/ Z1 ~5 c. B
   if (yDir == "down") {6 s2 b1 R8 B( W/ B. G, s+ M( N
      yPos = yPos + BallSpeed;
, Q1 t: m( O  ?/ A9 h8 J( A% r! _      }- l2 p9 g- t3 q1 u& p
   else if (yDir == "up") {5 L( v- M# u$ Y9 r
      yPos = yPos - BallSpeed;
0 F& }! t8 ~% V      }
; s- {* l% H5 L2 o3 w' |1 \   else {1 y0 j# A9 k. f/ {0 v6 B( V1 S$ X
      yPos = yPos;' J* ^1 J4 S9 |9 |
      }" c' m" A$ y) z2 Z6 ?
   }
2 F% d& X% H* e$ R% @# R5 I
* s3 s! g/ f" Mfunction hidetext(){! g8 L* O3 J, l! o- X3 I  f
if (document.all)! n( ]; w% E) D/ S% b% R( h
supertext.style.visibility="hidden"
% e; A! `& @' n0 _* h2 Jelse if (document.layers)
+ |0 L4 g6 X$ |, @: h" y. @, edocument.supertext.visibility="hide"
8 l8 W4 b5 g* C: x7 Y5 cclearTimeout(animatetext)
* ^  ]. G6 G. o" A6 K/ H5 w}1 Q/ o# ?) x; u0 e- L# R3 g% T
) @; Q5 g: m4 C) N0 z
if (document.all||document.layers){  ?0 B8 T: b" a
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
  Z: R: v  V! @9 Q6 cwindow.onload = initializeBall;
: ^% ?4 n; x, X( q2 a% Awindow.onresize = new Function("window.location.reload()");' n" \4 l" f" t4 G  o9 U2 d  g
}' C, m2 Q5 ?1 L/ U( p3 B0 t& y
6 M- U% F9 d0 K5 c! ]
</script>

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