获得本站免费赞助空间请点这里
返回列表 发帖

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

<style type="text/css">+ p* J: e; ^- V: ~1 H8 q
#supertext {
8 C0 ^+ T5 I3 M; U! Qposition:absolute;# N9 j- ?& c* }" r% q; z; R: B
left:0;; V1 \' x" ^+ `% Z
top:0;2 O' c" ]! z& m% F3 K$ K5 F
visibility:hide;
' ^) h7 O( i: b# m) P; }visibility:hidden;) g- M+ i% T! u. y  F8 e
}
& d, r: c# A/ R3 L  v</style>
; F9 ]; a+ ~1 G. @<script language="JavaScript1.2">
9 Q0 L! [- H/ @- j  y0 N<!-- 改变下的字体的大小。颜色-->9 j# a) t) c9 v4 ]
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
" X+ Q* s3 n9 E: e% U3 `$ c& E4 y% n9 _var hidetimer='';
( I8 n* J' h7 T) ]) Q5 S& U3 }8 c4 S<!-- 改变下的弹跳速度-->
+ D  R8 q# ?' l" y; h+ rvar BallSpeed = 20;
: Q1 R9 G" Q2 J* {$ b! Y, [var contentWidth;
! |+ Q3 I# J5 S8 V! q2 ~% @  C3 B" Rvar contentHeight;3 e5 z4 d( I9 ?, b
var maxBallSpeed = 50;: {/ P( A% d" W2 p

* Q3 v2 S- J! C- }0 [) h# w  B3 B) v+ h& [8 W4 n" L# g4 g( P
var xMax;
$ A! s) e9 ?3 w7 l/ n1 xvar yMax;; X9 `7 ~/ m; u/ P& E5 _- O
var xPos = 0;
; s8 U9 b9 P3 c8 [5 ^" Cvar yPos = 0;3 B$ s$ E3 {) N; P
var xDir = 'right';) H" U* F( F- @, P
var yDir = 'down';
7 U* x: w7 a  k% V' _/ ovar superballRunning = true;
$ U' V5 ~& O3 L( L- h: wvar tempBallSpeed;$ n: W, L3 ^, P: E
var currentBallSrc;# a6 b6 f$ |  W! x, ^- ?
var newXDir;9 \5 M; Y7 Z9 t: l5 @
var newYDir;1 G& b' y8 Y' p1 `8 N

) n# S: T* G0 L" L5 ]function initializeBall() {
6 Y: O  H& p* x0 p8 V   if (document.all) {) _0 C* ^3 Z1 t+ N& E. a! L! \& ~
      xMax = document.body.clientWidth5 T6 P( F' v5 M6 h5 t
      yMax = document.body.clientHeight/ e& y  N6 p) n
      document.all("supertext").style.visibility = "visible";
& ?9 W0 i8 k: R$ p, v* w      contentWidth=supertext.offsetWidth/ v9 c; ~* I' g5 {$ S% Z  K9 a. z
      contentHeight=supertext.offsetHeight
* V% t$ g4 u, d; ^1 }      }
, n% Z0 X/ Q3 }) |4 b, y   else if (document.layers) {2 ]- S+ ]# J, b" m! P" j2 {
      xMax = window.innerWidth;
  f& {4 S$ l! e! p8 K+ r      yMax = window.innerHeight;
0 [7 j4 h# w+ j3 x7 v      contentWidth=document.supertext.document.width
9 S0 d( u! j# @- w1 |      contentHeight=document.supertext.document.height
. f9 Y% b: k4 G% |3 f/ }2 Z      document.layers["supertext"].visibility = "show";
6 Z0 `1 I/ O9 S( O' {3 t( H+ o2 k      }
% l6 T5 e2 K5 P. O   setTimeout('moveBall()',400);9 R3 q# g- n* n9 B+ ~; _1 _5 `
   if (hidetimer!='')& Q, Y7 ?. p" p1 I0 y* U% I
   setTimeout("hidetext()",hidetimer)9 `& @8 {$ k1 I5 Y; [
   }
  |9 q7 u. w1 A' I4 u
& C0 p' K. y! r" D1 Z. K9 pfunction moveBall() {
' n1 x' e5 b# T- S5 v+ K$ e4 I   if (superballRunning == true) {, p( J3 D# [' M4 y* b% |
      calculatePosition();0 K3 _; F* X$ S. ~2 P) U
      if (document.all) {/ e7 i9 J* K0 W: L) w$ q8 P
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
: r% b6 S# @; z: ^" X         document.all("supertext").style.top = yPos + document.body.scrollTop;, M5 N! U- y6 N
         }
* B& u5 Y0 r- _3 A# n0 @) _      else if (document.layers) {
1 x5 ?) S  k% }+ N5 G# r; Z0 x         document.layers["supertext"].left = xPos + pageXOffset;+ z8 _+ G! ?" Z0 d4 a: [' E! z
         document.layers["supertext"].top = yPos + pageYOffset;
3 z( h; S+ R& |1 }$ C4 n1 e9 d- T7 w         }* ]& c9 B5 g& }
      animatetext=setTimeout('moveBall()',20);
0 [3 O3 w$ O; T" L      }
2 v  F9 b7 N( _% }" R/ @% A7 }   }0 [: \+ U! r8 J! |: p6 k9 Z6 E$ _
# b( L' B  Q; s: S' @: G) K
function calculatePosition() {
/ h2 A. S8 N; d: c   if (xDir == "right") {
# l. p9 t" T! n! ^  T+ T0 T" d      if (xPos > (xMax - contentWidth - BallSpeed)) {# k* ^$ W5 U  b( \
         xDir = "left";6 s( X/ L( m& `: D
         }) }- V. \# e- \3 ~$ x9 U
      }
7 K% }6 q6 `% c- i8 k/ ]7 \, r; G   else if (xDir == "left") {5 W- E/ |% i) E4 V5 n1 _$ |3 e) Y
      if (xPos < (0 + BallSpeed)) {5 X8 o. F& @* G) z/ c7 b
         xDir = "right";/ |# Y0 M$ B" ]
         }
4 \6 g% }' K4 c! J- M      }4 |6 b$ t, A/ ^
   if (yDir == "down") {
5 o# Z1 ^( l  N. O* _      if (yPos > (yMax - contentHeight - BallSpeed)) {1 f% X2 z% b9 d# f8 K. j
         yDir = "up";  p4 ~6 k* a  l3 @! V  t
         }
& Z! {+ ~9 G$ j( e      }9 \. n* R0 E9 [. S+ X2 E# a* {. P
   else if (yDir == "up") {
" m: p' i) W& b/ _5 q1 ], b      if (yPos < (0 + BallSpeed)) {
4 @7 O; t* C& ?+ _! d         yDir = "down";
+ y" q$ E( ^% ^/ ]- ^- e0 x4 X* @& @         }
' O! y; p2 W0 Q5 t# M8 t4 _1 L      }* o4 M0 o/ K! x& X
   if (xDir == "right") {
2 \; `+ L" I3 r& O3 i8 A      xPos = xPos + BallSpeed;8 o" T/ R8 c5 U6 [/ {4 D: ~
      }
% h# L7 ?( l2 S0 q   else if (xDir == "left") {
5 P" c& I, {0 u; u0 D      xPos = xPos - BallSpeed;3 A$ Q9 L7 }9 N: A# i( ]
      }
) R2 l% i. U+ ?; h& @   else {
% Y, f/ R2 h5 ^7 T, V      xPos = xPos;
5 [6 S/ e' a5 b+ e) d# ?      }4 G  q$ C) {" {8 T% m4 j( @( x
   if (yDir == "down") {
, i( S+ ^7 F# }4 m# |: {2 r+ z1 B      yPos = yPos + BallSpeed;
: j( w6 W' l" _; d      }* |& {% O" V6 U: a; G! T
   else if (yDir == "up") {
" n; b! F6 g" E. j$ L      yPos = yPos - BallSpeed;
. P7 e" q( K4 H' _      }
# Z0 g3 D4 t% j2 t' ]   else {  z' ]1 a, Z' c4 d- G# t
      yPos = yPos;
; Z- ]# x5 Z# P& x. s0 P8 z      }
6 I6 u3 T& M/ I2 Y) T   }
9 j, e# I- a/ ~! Q6 O$ X3 w/ ^+ P/ b* {' Z6 W
function hidetext(){1 ~  R. B' t# o7 D
if (document.all)% m9 N7 a4 Q1 l. u  H
supertext.style.visibility="hidden"
+ O, Z: k( k3 Helse if (document.layers)
/ i3 y( {6 e. }1 g& e3 bdocument.supertext.visibility="hide"7 ?  E! D/ W; D9 A6 _; }
clearTimeout(animatetext)
' l# v( u7 I" u# c2 v1 W$ s6 ], F}
7 ]) N& I/ M- l0 u0 z7 `
# p2 J( v$ W; U9 W* Iif (document.all||document.layers){
: W, d4 S( t9 F5 p" c9 T8 V( y/ fdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
# i) |3 `8 n1 N8 cwindow.onload = initializeBall;* n; |2 C+ Z! J, k$ y6 m, b: f
window.onresize = new Function("window.location.reload()");
4 u" O& a, R, f5 K( e( J; q' T}
' G# d2 i6 e( z$ T
, X1 O; @- n/ F4 F3 \: n' V, u</script>

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