返回列表 发帖

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

<style type="text/css">
7 z+ a- E2 Y3 o: q8 @#supertext {
6 D% P5 C; b1 _position:absolute;7 i, ~! ~3 W2 W
left:0;
- X1 }7 d& w! F  ?top:0;/ Z! W$ O  B4 s
visibility:hide;
. ]- V- K! h9 \5 m9 h$ E. `1 h: b7 Hvisibility:hidden;3 ]3 K% w+ {" X: d+ I
}4 s5 I8 i: z: ~# D
</style>
3 z/ W! U' o7 S$ q" K, b, H# u<script language="JavaScript1.2">( T0 U$ L! W+ o9 S/ o
<!-- 改变下的字体的大小。颜色-->! i5 k7 q( v, _. z: P6 z0 _
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'* N5 M$ k5 N0 Y; G+ {) G5 H' e
var hidetimer='';5 W( D  ^0 ^6 m3 R
<!-- 改变下的弹跳速度-->! R9 y6 F/ o1 ?/ j4 `4 U
var BallSpeed = 20;
+ i$ X/ o. J( _. X. Z% zvar contentWidth;2 @; ]7 _1 b9 Z6 |  w. S; e
var contentHeight;! Z9 W2 j4 Y  d+ e
var maxBallSpeed = 50;
* Q2 r1 o8 [* t. h- [  L# P* F% |$ S
" |* Y/ ~1 I4 E& R; y- P: z* h! X' c. ~: J; @1 H! ]6 E
var xMax;
8 b/ d4 y8 V5 I  Xvar yMax;( W: Z- h5 m) ?! D8 a3 H, }
var xPos = 0;! k" z1 \/ J% }- \
var yPos = 0;
& [1 v* o; t' R3 Dvar xDir = 'right';; J* j3 s; f  t# h! r- @
var yDir = 'down';
  G( L' _( x# y2 ~# Rvar superballRunning = true;
! R7 S( m3 g7 c- W5 D* Q3 wvar tempBallSpeed;9 I; T" c8 a/ s* U7 ?
var currentBallSrc;
  d/ s* N# @. K6 ?3 |0 ~4 c; wvar newXDir;3 j& T, B' f- b! s3 M- k+ G
var newYDir;0 s* B0 f/ w% u1 ?

. ^4 g, s4 O/ z8 y5 ]; M, Rfunction initializeBall() {& U* \5 v. f, L& g" F
   if (document.all) {8 z5 `+ _0 s+ D. m
      xMax = document.body.clientWidth
4 K2 e+ m3 T- a: E2 l      yMax = document.body.clientHeight
# i1 w. x% ^& I6 v% k' p, ]% _6 ~; Q      document.all("supertext").style.visibility = "visible";/ }, v: K8 K! T
      contentWidth=supertext.offsetWidth
, [! L: t. Y7 y' H& m0 H1 C      contentHeight=supertext.offsetHeight; }# L$ l, }5 q6 O5 |1 j6 N
      }
& k% c$ M, A. w& `   else if (document.layers) {
' O# A2 [4 S: S' O5 J      xMax = window.innerWidth;
; o+ L% k) `( U  Q% h+ D3 @      yMax = window.innerHeight;
$ q; n4 f5 e5 E$ {4 g- F      contentWidth=document.supertext.document.width' ]& ]7 ~8 v1 x3 b& S3 z8 p
      contentHeight=document.supertext.document.height
8 ?# Z7 ?4 q3 M( Y7 b, W* D* h, `      document.layers["supertext"].visibility = "show";- ]! \- k# O9 K, i8 U  @8 Y
      }: w7 W0 v. m5 K# Z, w- m
   setTimeout('moveBall()',400);
3 d( J: j5 L6 r" m" |1 U. N   if (hidetimer!='')4 S: B* D! W" Q0 _
   setTimeout("hidetext()",hidetimer)
5 U" G2 O% i0 S8 D- R   }
) W2 z9 ?( p+ C# l+ U3 h
* z! f& ]: A1 G/ ~function moveBall() {) g0 j. t6 Z; T' J/ X8 A; Q
   if (superballRunning == true) {# S8 G  V/ j- \# R% w; X
      calculatePosition();) m6 Q9 f4 u" R
      if (document.all) {( R! @  Z9 P/ @3 }9 Y" [7 `3 R7 K
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
" b2 O5 ~. d( G- f/ G+ \1 d" j         document.all("supertext").style.top = yPos + document.body.scrollTop;
5 X! L$ `" ]% F# k$ j8 V+ U# Y, q2 U         }- h- z+ \' r' t5 h" n/ O
      else if (document.layers) {
* t3 P! y+ D1 P1 z+ p         document.layers["supertext"].left = xPos + pageXOffset;
3 u' q, E/ P3 Y1 Q2 W7 j$ o' H         document.layers["supertext"].top = yPos + pageYOffset;
, t3 p7 h% p  i/ B& ^7 g         }
$ g. X$ m" b  q8 F      animatetext=setTimeout('moveBall()',20);
; k  p0 {- q/ D1 Z# {      }  J% q1 j3 |& Q4 `0 {
   }
- L  |6 z! }8 O2 h# e
0 d9 G, Y+ q5 a. u' `1 V' ffunction calculatePosition() {
' g: v" O2 N* e  Y   if (xDir == "right") {
( o3 [6 r" U2 K$ v  P* x      if (xPos > (xMax - contentWidth - BallSpeed)) {' M) O/ y* Q9 l& o
         xDir = "left";
$ m  A, k* J) a1 U( W         }
. Q' s+ L% y+ c+ `      }& q: }7 ^7 \) f3 w8 r( a7 U6 I
   else if (xDir == "left") {
. L8 M1 }2 P7 j      if (xPos < (0 + BallSpeed)) {
" _0 M( M& o3 o* x0 p" P         xDir = "right";2 q) F6 X5 h# p( c
         }
# ~$ p/ M, r$ W( y$ n      }2 c* l, \2 d6 a( W0 @5 j
   if (yDir == "down") {
9 z# s4 k: o" i) H0 n2 ]      if (yPos > (yMax - contentHeight - BallSpeed)) {
7 l( I: F) c. u# T- x6 }  \         yDir = "up";
( |: b* [9 J; Z5 R; G/ c7 K- o; p/ H         }8 B3 i+ Q6 T2 u& g
      }; F2 @4 B1 O  u
   else if (yDir == "up") {0 X1 ~; Y1 x0 q  D; G) ^% K& e6 i
      if (yPos < (0 + BallSpeed)) {
1 [- `# d! b. F) ~" \3 b         yDir = "down";! d' D/ Y+ M, Z3 j5 V
         }( T# @' d$ f; m; W; F
      }6 _8 U9 |/ w2 @4 w
   if (xDir == "right") {
3 E' r* d* v" }& R! x      xPos = xPos + BallSpeed;6 L7 s! x3 ?* u! @2 Z8 t
      }
2 m7 R5 a  C% b' G8 k! n3 [% S; _   else if (xDir == "left") {% S4 b6 i0 z4 ^( y
      xPos = xPos - BallSpeed;
  h4 L+ c) D' G4 J8 ]6 H      }
2 n3 |2 R) i3 f) V" F; D   else {
4 [9 L; V7 ^) z0 x8 x. F8 F) V7 l      xPos = xPos;: U! V8 o- k: L3 s- Z4 _) l
      }( q1 }& p+ Y/ {1 Z. ]
   if (yDir == "down") {% G% g: d7 @' ^) i( y* a$ P; g
      yPos = yPos + BallSpeed;* y( Q9 X- A& X4 w: c
      }' M/ B% i2 `0 @
   else if (yDir == "up") {! G' x2 I% J3 @! |1 p- x1 D
      yPos = yPos - BallSpeed;
2 r" \- g! O" g7 d  H      }
0 ]. R( g6 A( Y/ K; D   else {
4 V4 u4 k2 r) _& x2 f! `      yPos = yPos;" M- m0 S* l; p3 e5 `, L
      }/ p6 F( L3 h4 l5 y# L7 \
   }; c! |( y9 o  W; o
5 ^( T. O6 `- g* e( G; ?& k
function hidetext(){
  s0 ]3 c8 \/ v/ t, W5 n, V1 C5 d) `) nif (document.all)* F0 ^2 ^6 h: B6 F
supertext.style.visibility="hidden"& o( a5 }7 v# {$ ~0 [
else if (document.layers)3 l1 @6 G. O2 H8 T. N8 p' k
document.supertext.visibility="hide"2 d: V0 e7 S) n
clearTimeout(animatetext). p, {% u0 u# [9 `7 M; n
}
; ~  z7 r! O; I% Z1 Y  p8 _; }9 d9 j5 @6 \
if (document.all||document.layers){" u" c. v( J# q7 v5 k
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
" z3 p1 [' D/ Jwindow.onload = initializeBall;/ b; W6 V. i+ O2 n5 ?$ q6 H* q0 @' i
window.onresize = new Function("window.location.reload()");" f) U$ a/ a! M6 x2 K! i
}  R, v0 [0 n8 B

3 i" W0 n' m/ ?0 V</script>

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