返回列表 发帖

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

<style type="text/css">
/ ^/ U* p/ d- n, G& t/ L0 g#supertext {
+ O; Z) P4 R' U( Y1 ]$ ~position:absolute;
- e/ `# j8 h, C& lleft:0;
- t' J/ C" o) ?' {top:0;6 K* L0 i% Z9 [- P  W
visibility:hide;
; A( r. P6 `* [/ A1 S+ Z' h+ evisibility:hidden;! i% o( p$ y2 ?& u# m, Y
}- Z' K, o. Q. }0 }4 Q. W9 W
</style>4 V8 I( R3 r' j+ {1 e7 ?- B$ @
<script language="JavaScript1.2">) E6 n3 ?" U  E( _  V) o/ m
<!-- 改变下的字体的大小。颜色--># Y4 d$ T5 S$ }
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
0 T1 h9 @  p& uvar hidetimer='';
, m& e( B/ G* e2 k6 k5 e+ A<!-- 改变下的弹跳速度-->
* K% U; A, Z  k# Q6 b3 Fvar BallSpeed = 20;
! R& A7 h& y  s- b! {. lvar contentWidth;2 d$ A# s! [* C* Z
var contentHeight;
* Z$ p7 w3 q. c8 R/ h! q1 jvar maxBallSpeed = 50;
& u6 F( l5 y' V: I- h8 A6 L. o
+ u% G: V% T& m4 O7 a: b
5 D3 e0 T" u! ?  L) N% Rvar xMax;8 _' {6 n4 g& Z  F! D! {4 l
var yMax;
$ d2 y& ?# }% [& H+ ?! [) {var xPos = 0;
: o' g9 W  d# v! }+ W$ avar yPos = 0;3 l6 a  }, a2 e$ I' J; [
var xDir = 'right';4 G6 x5 M7 k* L/ _4 E, E) ?
var yDir = 'down';
  ]. @* J$ P$ s8 J7 dvar superballRunning = true;' t5 k+ k5 B4 \  |- Z- R3 D7 i, N
var tempBallSpeed;2 U8 F* d3 J! r2 S  J8 p8 s( f! Y
var currentBallSrc;1 }) O. j* B# Y* C( X; ]% ?% K
var newXDir;
- _8 F$ ~- f; z8 }var newYDir;- m  y9 v& z# d2 i% y7 @/ U( k9 N

! k" s5 t4 n& `- ]% e& l: r. j" |function initializeBall() {! P% ~# G: Y8 h: g) p5 D1 S
   if (document.all) {
) f6 G! m0 Z( K3 m. l      xMax = document.body.clientWidth
7 i% Y2 x% @7 U# |3 t1 U6 E      yMax = document.body.clientHeight9 U1 u( A/ X# E8 y" z
      document.all("supertext").style.visibility = "visible";
0 G7 j1 _+ l" j4 D% E9 L  }      contentWidth=supertext.offsetWidth+ J4 T! v6 _# w
      contentHeight=supertext.offsetHeight
3 k/ w+ M0 _0 I& c" Z      }% p0 a5 }. Y( e, ^' n/ e; H
   else if (document.layers) {
' D6 |4 ^  H+ F# d8 g1 E4 ~) {      xMax = window.innerWidth;
! d  C5 i# Q8 f7 p& ?' K( a! j- h# t      yMax = window.innerHeight;
, M! t9 T9 @  g8 J6 x0 S* |      contentWidth=document.supertext.document.width% U4 G  H1 [- N7 {
      contentHeight=document.supertext.document.height
& r5 V! I: S/ u& r      document.layers["supertext"].visibility = "show";
: @1 \# v: h/ b% @- W' |* w      }
6 u1 s7 F' Z4 f# r; B- K   setTimeout('moveBall()',400);
9 y3 h( [+ \* a* q- s2 G8 Q   if (hidetimer!='')
: G! Z; j. z! A1 ^   setTimeout("hidetext()",hidetimer)
5 z4 I+ o/ v+ I8 @6 z   }; i* l( G% v  m' a
" p8 L& i* Y9 o, ?
function moveBall() {7 _* \$ ?" f) i, B0 v
   if (superballRunning == true) {
; K9 {' s9 l% T' s) c3 R0 X: o      calculatePosition();
" }% M. O5 V2 q      if (document.all) {
' [; N7 B8 b7 ?+ f+ j% Z0 N5 _0 I         document.all("supertext").style.left = xPos + document.body.scrollLeft;' N" f4 I$ c0 G$ A; s" \+ s
         document.all("supertext").style.top = yPos + document.body.scrollTop;
- T, M* ~, ]% U) J. V8 |1 Y         }- W, T  ]+ R  k) I
      else if (document.layers) {
  ~( T* |: \% E: F; C) F2 M         document.layers["supertext"].left = xPos + pageXOffset;- t3 o. j& {5 g' r, L
         document.layers["supertext"].top = yPos + pageYOffset;
% a$ j: n. L& _. n% A         }
' y( |2 p9 A5 i% d/ o, K/ {      animatetext=setTimeout('moveBall()',20);, C  ^1 @( w+ r
      }
. p5 H) ~/ N# R   }
/ ]; N# n& `- R! P/ F
  D7 B: O, l2 b) R* w) j. wfunction calculatePosition() {- n' E4 ~; [* J
   if (xDir == "right") {
0 v. i# E) \) v& _      if (xPos > (xMax - contentWidth - BallSpeed)) {1 ^+ m5 O- G  V0 n8 j; n4 e: @$ M
         xDir = "left";: O9 i2 Q7 i5 [9 B4 t, [/ p+ u
         }
; _0 S9 f' \) V* m      }
0 @0 p5 G& m" q! ^- L, {# U   else if (xDir == "left") {1 E. `7 e" ]; R; l
      if (xPos < (0 + BallSpeed)) {
1 h% p" A. O9 ~7 I1 P         xDir = "right";
+ {+ E) G# j7 Z; @         }
( T1 U6 M: I9 d: u; k      }5 w* V. h1 [1 {9 G* ~, A4 {& c
   if (yDir == "down") {
, J& s' h6 N0 H8 F& F      if (yPos > (yMax - contentHeight - BallSpeed)) {$ L& t/ x. n% B5 q/ s; l
         yDir = "up";, q/ R2 V* |3 X! g7 ^4 |  p% M
         }# i  J5 S- ^3 `2 O5 O* w
      }1 l/ `8 h* Y% f% A
   else if (yDir == "up") {
" \) y9 p  c8 M' Q6 S      if (yPos < (0 + BallSpeed)) {
) P% q* Y' X# ~8 f7 I         yDir = "down";
$ I8 g5 z, V' E, [& b9 a1 e+ p* K- t         }
5 E+ b* z! D" J) f: B! M/ J      }
) P. z( J- f4 @5 @1 m   if (xDir == "right") {3 c/ ?3 ?/ H. |: k5 f! [  T+ f7 V- W+ ]
      xPos = xPos + BallSpeed;* }% |. B. F! h" m& `
      }/ @1 ?* z+ G& S& J
   else if (xDir == "left") {/ v4 E! }$ o" @2 i2 I/ K+ k
      xPos = xPos - BallSpeed;
1 W" e; g( Q" P/ d  p+ p      }
& F0 \4 [' _+ N: P   else {
2 s, f% Q- K/ I/ f6 |. o      xPos = xPos;
" l# W. E) J- L+ ~3 A, `      }+ b& _) J1 _! H; b. [" g
   if (yDir == "down") {6 m( B. f* R  h: k+ t
      yPos = yPos + BallSpeed;5 ~" A; J0 h) u9 q- h& X+ E
      }2 L$ C7 d! N+ J& R
   else if (yDir == "up") {
- G% T0 u' k* d, f3 H+ r0 n      yPos = yPos - BallSpeed;) @6 [; h# L' l% h5 w- R
      }
. Z; l2 t- b1 b5 c! ?   else {
+ O" r; |: r$ c+ d$ L$ A      yPos = yPos;
4 ]6 q+ [. G- u& I# E4 H: V      }
+ I  u2 ^; m5 k( T! q6 h# }   }/ N& k) Y7 A. v, ?+ X' \6 F

, v! e& C& i; }0 @. X( N0 @/ E, Pfunction hidetext(){; z& S& P9 Z, U$ o3 O3 ]4 _
if (document.all)
7 k: H3 P  X  C( g% w. Esupertext.style.visibility="hidden"$ R2 C. x5 f- s: w
else if (document.layers)( o& M# ]6 u( m0 Q$ B: _
document.supertext.visibility="hide"0 S7 Y0 [2 ^- B* c7 t
clearTimeout(animatetext)
$ I# D7 [4 E1 J' w5 g) S}) Q* w% Z/ t0 E# A* P" r
( @7 i1 K3 W: ~# Z7 Q7 N7 Y
if (document.all||document.layers){
! m& g$ t  G! ]' O9 o, y  Gdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
7 Z9 S$ |+ Q% V+ }window.onload = initializeBall;
/ s. C; Z. U, Y$ M! Mwindow.onresize = new Function("window.location.reload()");2 w7 ], I( `5 j: U7 a! t, N
}
- e, @7 U6 z0 W
0 k! T6 _# T. A</script>

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