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

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

<style type="text/css">! r9 P( t6 X! T( |% i/ @( T* l8 Q! p
#supertext {
6 T1 u, S: i  Z$ N" v: A1 ?position:absolute;! o8 ^( M! ]. L0 c
left:0;
7 }2 }2 y  F* @' z5 K( Vtop:0;$ L3 \( V+ w/ q/ R+ Y0 W
visibility:hide;
$ m0 e$ Z( }6 k1 T: `: G/ ?visibility:hidden;6 F1 ]! w! S. S( l* W
}1 E% L8 @9 @% l
</style>( a/ {$ w* A3 [" o7 e( q
<script language="JavaScript1.2">0 `1 q1 s& c- l# W, l$ l+ }+ G2 R/ ~
<!-- 改变下的字体的大小。颜色-->  S$ t& O' |) u1 W
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
$ Q$ d3 ^: r! W# bvar hidetimer='';3 p3 q0 Y* p4 X8 r" U
<!-- 改变下的弹跳速度-->9 B  P1 F4 r8 g* ^
var BallSpeed = 20;
$ J  L- }! B3 n, R& yvar contentWidth;
3 X. P2 {+ x( V5 E% u& q9 Dvar contentHeight;
( n1 c- S* M% G( G: `var maxBallSpeed = 50;
# w3 z& t7 z  f4 q3 h% C3 _
' K/ g9 X: ^/ ~) \8 x- w+ }  a  t: ]* A, G
var xMax;3 ^5 H0 }6 ?+ Z/ Y
var yMax;
; ]8 {& J! M! t# R) q2 S  nvar xPos = 0;: D+ N7 O3 H% P% L
var yPos = 0;
7 H: n& B( P& Z2 ?* I: d$ Xvar xDir = 'right';
4 Y; U4 x+ ?8 G4 K$ n+ M  f( Cvar yDir = 'down';
2 w9 D0 I( S! @1 N2 m9 T4 Y, R4 U1 ^var superballRunning = true;
6 }6 H/ |5 K1 K/ G" Evar tempBallSpeed;* I$ W  J3 G3 B, I
var currentBallSrc;5 ]- }2 j& J8 q3 q4 M$ o7 O
var newXDir;+ \0 O8 v8 e! w/ G
var newYDir;
5 Y5 L: W8 X6 C, n2 T% f+ E. J, u7 g, ]8 W% b
function initializeBall() {! R( x( X% k" d% K2 _, Z
   if (document.all) {
' ?  R. Y5 Q4 J3 f4 @) p% F# g      xMax = document.body.clientWidth9 _9 u3 p7 I! w8 u/ O! v" L" C" b% W
      yMax = document.body.clientHeight5 C+ }! o) @# O# ~7 g$ f
      document.all("supertext").style.visibility = "visible";
( b# G8 Q+ ?4 S0 ?. t( @      contentWidth=supertext.offsetWidth1 q: j  ?0 }" e7 w, P
      contentHeight=supertext.offsetHeight/ Q) j; A3 J! o$ c
      }. W6 w* Y4 r1 k
   else if (document.layers) {8 g/ }9 R3 v( y: {5 J9 A& m
      xMax = window.innerWidth;, H/ C2 g2 L0 h' |
      yMax = window.innerHeight;" j, @, Q! @+ r" W
      contentWidth=document.supertext.document.width
5 Y* {% }8 }( I( X+ S) v      contentHeight=document.supertext.document.height8 `/ }% p5 D  P6 q, P  Q, O
      document.layers["supertext"].visibility = "show";
" K% r1 j% c, w5 H8 `      }6 ?7 E0 e3 d6 p7 Z
   setTimeout('moveBall()',400);( A1 b* D, Q% Q- }% L
   if (hidetimer!='')
# w& J2 N/ X  z+ y5 R! I% g: G: {   setTimeout("hidetext()",hidetimer)
6 V# W0 _7 `( M. S) `$ K: o' s   }
& `" E  n$ J5 S# n' r: \) z$ P7 L& n8 a! \" P
function moveBall() {
0 y0 J& h6 k& S1 T2 \2 r   if (superballRunning == true) {
0 [8 ^3 C4 r) i4 ?      calculatePosition();
- D# H5 U- d# M. i* ?8 M      if (document.all) {
! g- `+ `" G( M+ {9 }6 E( T         document.all("supertext").style.left = xPos + document.body.scrollLeft;
! g2 f1 n- N' P+ C0 |         document.all("supertext").style.top = yPos + document.body.scrollTop;
0 T1 k0 X* y* t- p, V         }
3 t8 I' [, C/ d) h( L5 g; H      else if (document.layers) {. b/ T" j6 x) X1 U! ^
         document.layers["supertext"].left = xPos + pageXOffset;
! Z1 ~1 s6 _3 O8 }0 c         document.layers["supertext"].top = yPos + pageYOffset;& p% ?& Z& p" u; X) y  r2 y  M* f
         }. W  o3 _( W$ u0 O# a. w' x
      animatetext=setTimeout('moveBall()',20);) P" w, R: d; r; E8 J$ [$ A
      }
  M: U" i+ b* j# |# W. @* R9 _   }3 Q  z0 m% k" T: D; S; E, d

" Q2 v! u. n; t1 I$ Mfunction calculatePosition() {( i; e/ X0 F$ R# Q* V# O5 C; |
   if (xDir == "right") {, r5 u. c1 y5 t8 K  ?
      if (xPos > (xMax - contentWidth - BallSpeed)) {# @' ]+ L) \1 s% ~* v6 Q! g
         xDir = "left";
% b1 p) b2 t, k9 [% y1 u         }
7 Z6 p3 Z/ m1 ]$ w8 b4 O4 r1 u0 Y6 d      }8 A- O3 o3 V5 I  M0 y8 [
   else if (xDir == "left") {3 ^! v* D0 t! P# f1 }% v
      if (xPos < (0 + BallSpeed)) {
+ r! h$ a/ L9 H- t3 h3 l; o9 k         xDir = "right";
* M, r6 ~7 K. E( [" G5 I         }
6 c* _! ~, }: @; z! g0 i      }  M1 I" w" i4 S! {
   if (yDir == "down") {
" V# M! @& ~7 V" r      if (yPos > (yMax - contentHeight - BallSpeed)) {# a& j$ g2 {8 t* [+ a- U2 a
         yDir = "up";
5 Y9 N# y1 t/ r4 }: M* R! i% T: w* B% R         }$ m  M3 _( e. \6 j7 M* \
      }
0 r- R1 L9 i9 R/ t   else if (yDir == "up") {" i+ a  f8 H* M
      if (yPos < (0 + BallSpeed)) {
$ M2 `* Y* o# `& S6 {1 `- ~         yDir = "down";
9 O) l  k% z+ e" k- q         }, C5 R9 R2 `' h$ P( V
      }
3 u9 ?# l- b% S, ^   if (xDir == "right") {
# f, s  ]6 T0 |1 D" y5 j      xPos = xPos + BallSpeed;: }; a5 b4 |8 [: ]
      }
* E; d- Y' T% ]0 J+ c& x3 n5 B   else if (xDir == "left") {
& B; [5 f9 Z. @- c$ H0 E2 T      xPos = xPos - BallSpeed;
7 V. y' q1 _. h4 ~      }
4 [$ y7 ?+ b& B4 A; x7 ^$ e   else {9 x* _$ _: i& R5 A7 U7 E. s) G( b
      xPos = xPos;
0 C9 A- s) T0 e- I9 T: j' ~. ]; Z* W      }
! M6 W- Y7 [7 L2 M& @  u   if (yDir == "down") {* }* L" B- r. a& u, [6 s; `$ |
      yPos = yPos + BallSpeed;' j8 x6 Q' [5 O$ {/ X+ c7 J- O
      }
2 [) [: i2 _$ n. T1 c: s0 ~   else if (yDir == "up") {* ]! P/ M! _6 W9 O. n" O
      yPos = yPos - BallSpeed;: c  g2 M( F: S5 e6 {
      }) N% Z. [7 s, V0 ]+ A
   else {% ~* ~7 {: W! N9 @) U
      yPos = yPos;
3 X) a/ S7 f% U# V" C      }
& I: E. J% K' r   }
5 W5 i, b# Q, I+ V/ n& K6 \% O* S( }' [* e$ B; ^; S# [' q7 K7 h
function hidetext(){8 ^3 @) A3 F/ ~  s! g7 P
if (document.all)
3 }, k5 u  M  I! M, Z# Ksupertext.style.visibility="hidden"
. O, i9 ~+ I, N0 E* T7 Telse if (document.layers)
  H8 V) c1 x7 Y. D6 \8 X3 E7 cdocument.supertext.visibility="hide"
' Q' X$ ?1 F  j  |4 m; mclearTimeout(animatetext)
. k4 k5 ^2 v( r) t6 ^}$ O9 I  Z- b7 s  N/ F( ^& D
/ u  P5 I6 s; d4 Q6 \
if (document.all||document.layers){
% d5 o) g  q: C' B- V) Adocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
. s4 K" r1 e3 [/ U: Iwindow.onload = initializeBall;
) ?6 v2 D. v9 W, T0 ?! Gwindow.onresize = new Function("window.location.reload()");
7 f; r) k7 q/ J) j. R/ `}
$ N3 M$ @6 b: i$ _; B* }$ v* R; R4 w4 s$ N6 [' r' t8 i$ z2 c* d" U
</script>

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