返回列表 发帖

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

<style type="text/css">9 `& Y. S3 d, Z
#supertext {
/ F! P3 W% B. I; E0 H% T/ m/ n6 ?position:absolute;
+ t, n& v, P  xleft:0;
. B) T" n/ \2 q3 Ltop:0;
' P# s% `( ?6 h% K, I) Lvisibility:hide;
# d  p% A) X" s. }* Z; y! \/ B! W- [visibility:hidden;, F; K/ a$ k) [/ m0 b0 j" K2 Q
}
# A1 e4 e+ P- ^% j( I9 e; F</style>6 \6 f5 C! f+ h* r$ Q4 i, k) {9 r( _6 K, V
<script language="JavaScript1.2">1 Y3 b9 b7 s, l' ^# `, m' D
<!-- 改变下的字体的大小。颜色-->
# s/ t2 D+ R0 \# u! \; w5 F0 Hvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
/ i8 M  ^; J* M' s! lvar hidetimer='';) r: D/ F/ S1 r" b2 y+ }
<!-- 改变下的弹跳速度-->
" V4 g; Q: |0 _9 j( M+ N& rvar BallSpeed = 20;3 Z- P- A) t9 `, ^+ ^' k& @8 f
var contentWidth;; g. E) S1 f0 A1 s) ~# |5 E, f+ \
var contentHeight;
# \( e% L4 D" U# f4 O0 z3 \var maxBallSpeed = 50;
( F* H6 \! m, V* a& \% G+ c3 T) q) |+ ?* M% _5 t) W

7 {" ^+ N  h0 w8 }9 kvar xMax;- e/ z- X9 K$ {' n  t( {
var yMax;2 [9 h, n2 j* q6 U) h% T
var xPos = 0;* L, v0 n; W/ u9 {3 N% }
var yPos = 0;
4 D) w) g  [, Z7 k+ V% ivar xDir = 'right';6 Q' a: N+ c' b; p9 m; l. W
var yDir = 'down';: X: O" [0 U2 \' M
var superballRunning = true;: a9 t) ^7 }" g$ A5 [' N  h
var tempBallSpeed;
6 H+ [# J" P+ D. j7 Tvar currentBallSrc;
! w0 r) w& s% ]( Z) o/ a! @var newXDir;" h9 p* s4 U+ I
var newYDir;
- @9 M4 B; ]  I6 ~) W% }( S0 [9 e6 k# Z  v7 y" Z
function initializeBall() {- _) h' W/ L. j( X4 o
   if (document.all) {3 V7 j6 X6 j6 H; y) E# k6 t/ M  p6 i3 S
      xMax = document.body.clientWidth5 Y/ ^2 N3 S5 G8 @0 \3 @1 S
      yMax = document.body.clientHeight8 O0 _- g! e' ~& x+ F7 U& ~
      document.all("supertext").style.visibility = "visible";) d/ K; P4 \! I" A# Q
      contentWidth=supertext.offsetWidth, k4 S, i$ f" x/ H2 _
      contentHeight=supertext.offsetHeight0 v3 |- h, g- D- ?$ }
      }1 j# @) p, {2 o) Z
   else if (document.layers) {
/ U( G& B/ P. I      xMax = window.innerWidth;
6 G9 r7 D5 {# C$ A" e9 s) b      yMax = window.innerHeight;& \( q2 f! d" R
      contentWidth=document.supertext.document.width" Z; h/ S' H) _" X$ _
      contentHeight=document.supertext.document.height9 t9 l  q; O( }
      document.layers["supertext"].visibility = "show";
$ ?+ A8 g: m3 f/ v4 Z- w) J      }. @0 s5 c7 g$ o: y) S
   setTimeout('moveBall()',400);
. i& _$ \6 e0 ^   if (hidetimer!='')8 I5 s2 h2 @: w. r# p: |1 Y
   setTimeout("hidetext()",hidetimer)3 d3 \( c2 }, D  w
   }9 C1 h5 k  V5 [

$ s0 h/ `6 C1 z: Ofunction moveBall() {9 Y$ [* J; C/ p+ R5 b3 y8 A. @
   if (superballRunning == true) {: B: }' g6 u, f* w9 K7 k  s
      calculatePosition();0 v. J* z; z8 u6 j* O( y) F
      if (document.all) {: K  }$ w% \3 }5 D5 O6 H
         document.all("supertext").style.left = xPos + document.body.scrollLeft;) m9 O# L- F& o3 I1 _
         document.all("supertext").style.top = yPos + document.body.scrollTop;
+ h6 Z# C. N  K9 [) y( ?         }
  c0 R; t  W! V. I' D" V      else if (document.layers) {6 j- {8 o9 \$ d( a3 [0 h
         document.layers["supertext"].left = xPos + pageXOffset;
4 F3 ^( K5 @& Z         document.layers["supertext"].top = yPos + pageYOffset;
; D5 Q) ^3 o0 |+ ]' P, t         }  C$ `, Z. B1 B: {. M$ D" u
      animatetext=setTimeout('moveBall()',20);7 O. a/ S' G" h& `5 V# ], `/ k
      }
! Z% p& J: T( G. h   }
1 A" W. d$ \! [2 k# r1 l# @7 m& ?7 G) U( Q7 n' q2 Y5 n. K4 n: v$ W
function calculatePosition() {9 }- _8 X' R- d. M  R) a
   if (xDir == "right") {( R8 x  h, S* g* W9 v
      if (xPos > (xMax - contentWidth - BallSpeed)) {1 j9 l# z3 k7 S0 d9 [' k" M8 V  b
         xDir = "left";- \: C) M5 [9 r4 }4 d4 Z
         }; W6 x* X0 ?' \( J# `& U
      }) ^- k- `" t; y3 p6 }* }
   else if (xDir == "left") {
$ b! P8 p3 f# {# a      if (xPos < (0 + BallSpeed)) {
  E, z9 ~' [/ \1 V- n7 l         xDir = "right";
; [. j/ ]7 e) Z  j2 }         }( g! i9 d% C3 P! a6 ~
      }* z( O' l; i! C- {1 ^( s4 w# p! X
   if (yDir == "down") {, ]; R- q/ ]  N5 B8 k9 y0 k# a2 C4 a+ O
      if (yPos > (yMax - contentHeight - BallSpeed)) {
: U9 N. v$ o, \5 A* p0 c6 p% V. V         yDir = "up";
% r: s5 N+ s8 }, |6 O; K+ P         }
9 r0 S/ o; s. }1 E# q# @) \      }
; k) Y0 ?2 I+ P+ G   else if (yDir == "up") {
9 }/ X0 u# X: v9 h9 b& K6 e) M      if (yPos < (0 + BallSpeed)) {
% L% p) R  B* c/ d- g, Z5 {& E         yDir = "down";
# V+ p- D2 i3 l( H         }
& _- e  j( ^& m& m      }
1 r9 _0 I4 p, U* [1 q! y   if (xDir == "right") {0 k3 M0 Z* x. W( ~4 r
      xPos = xPos + BallSpeed;+ E, g* {  h% ?6 g$ J. {9 d
      }
, i7 m  u4 z' l7 V; n! x1 M   else if (xDir == "left") {0 R7 P; z: P0 }, ?4 z- U
      xPos = xPos - BallSpeed;' \7 F4 `5 C2 I
      }
- V3 c. Z: P4 f5 ^  Y% F   else {, {& M4 B9 }; M: S+ [/ s8 _
      xPos = xPos;
: Q, E# R0 b; u& d% z8 V; _6 O      }
: I# q$ o% {, V" Y   if (yDir == "down") {4 K) u. K' N% t( B) V& ^4 [4 v; w" _
      yPos = yPos + BallSpeed;
/ \3 G4 e6 r) D4 A      }
1 v6 Z3 s; H* _8 f: }* |   else if (yDir == "up") {
# T! o& Y0 ]- k  m. X/ F. z2 V; L      yPos = yPos - BallSpeed;( J% q( M. d$ W& _( [. m' R
      }
( b9 `# c5 ^; i4 ?   else {) h" D' i7 f2 F; O( ~$ @7 h  q' k
      yPos = yPos;
5 Y2 t2 h8 ?$ n' d) B: ~      }
7 U& [$ w+ t/ S1 H8 g* ^5 D9 t   }
/ S. X5 {4 [: N+ L' u+ s% K, e5 @
- V2 |) {$ s: Q5 y% q0 ]* _# H! v& jfunction hidetext(){
( k8 n. z6 j1 x, Tif (document.all)
7 u6 C# h, A7 y1 E, m# v& m  rsupertext.style.visibility="hidden"/ j1 U( v$ z6 [7 l; S# N
else if (document.layers)
' j, W& M6 n6 g! U5 Idocument.supertext.visibility="hide": Z0 |6 b% D* \" g0 ~# k
clearTimeout(animatetext)
# T0 b# L" d/ P}2 Z. e* u$ w5 m  F
( D1 i( w' B2 ^* {3 w
if (document.all||document.layers){
% O/ S  V: c, d: r$ n0 S. Jdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')* ^% G( f, I2 }/ M# @9 g1 A; Z* U
window.onload = initializeBall;
7 n, |" t. L- `1 P+ `window.onresize = new Function("window.location.reload()");
8 S9 {' S- {8 o4 I1 Z# N8 M: K( C}2 Q3 K+ h. N, `* u$ _; M8 B2 a

/ O) I0 f4 e6 @3 K; N</script>

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