返回列表 发帖

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

<style type="text/css">! N' n3 g# H& Z1 R( [( b2 ^0 B
#supertext {8 g/ m! ?, H5 B1 }; w- _$ s
position:absolute;( o# }6 d- [) r( `" k
left:0;( f' M( u/ s; p* N1 P2 H
top:0;: k/ ^  Q3 s5 A, |- d' E+ L
visibility:hide;
; t* |& f" n  Ovisibility:hidden;* g% F* f6 q+ I0 j3 W$ e
}
% W' j3 f% W) m$ W  f( k/ k</style>9 }8 w! `' R1 t0 F7 G
<script language="JavaScript1.2">
7 K. n+ L5 }1 n3 N7 z$ g<!-- 改变下的字体的大小。颜色-->6 B( R, b5 f$ B$ N" ~) b+ z0 B, u
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'7 t* i4 r/ |% J7 Q
var hidetimer='';7 ?+ S) i$ c% v9 j7 J, K
<!-- 改变下的弹跳速度-->
& T6 ]& l- p/ ]: ~2 e0 m7 \var BallSpeed = 20;! h7 r& t8 B5 q! m. ?
var contentWidth;  t2 _7 T$ _0 d5 {( E  O
var contentHeight;9 S- h+ K- @% o/ U1 c/ {" e
var maxBallSpeed = 50;( ^8 t. O8 @: W4 d9 z

! G) t. M) F5 Y6 |; E1 T  L( ]9 v7 ?4 z# @/ T
var xMax;# T, {2 l+ @4 Z7 q* W. A) C' E
var yMax;5 e/ c+ c# Z% L5 x' `
var xPos = 0;- J: h2 ]# H& Z6 ^( ~
var yPos = 0;
0 ]% }% r7 o" H8 f3 `5 zvar xDir = 'right';& t* u& ]1 I, u% l% S
var yDir = 'down';6 G$ J6 A% G5 E4 ~4 J) h
var superballRunning = true;: F6 R' ^$ d: U# a) m
var tempBallSpeed;4 O9 \% Z0 v/ l% ?  a
var currentBallSrc;2 _) Y+ Y! b  N" D4 v
var newXDir;! Y# S( l% |/ K* \" }1 k3 Y( T
var newYDir;
" C: b* q+ h4 D' O) ^
3 t/ ]' D( w) W; j8 ^! o% Hfunction initializeBall() {
7 H# w. [% i1 c1 g7 [  O! w7 _   if (document.all) {
- p9 v+ ^% M! ~) ^      xMax = document.body.clientWidth
8 {0 M2 w4 ^. c9 L4 U* M& m      yMax = document.body.clientHeight. j9 n9 w- w/ q
      document.all("supertext").style.visibility = "visible";: ]. p  C% ], \3 M# p
      contentWidth=supertext.offsetWidth- p  R9 `; V& Z0 u
      contentHeight=supertext.offsetHeight, h2 i7 N0 P; M4 ^! y7 r: a' \
      }
* V$ ]9 S- [$ ~   else if (document.layers) {" h3 L( [! E8 V/ W% Y, _
      xMax = window.innerWidth;
0 c# E" ~9 M, U9 B9 c/ T      yMax = window.innerHeight;) h. o" Y0 X+ y9 K2 c  G$ p/ t
      contentWidth=document.supertext.document.width7 J5 F3 U3 u! e1 W2 n+ Y1 `* {
      contentHeight=document.supertext.document.height- A4 x; w! j. E. O: N/ ^
      document.layers["supertext"].visibility = "show";4 Y# Z1 `; J! N8 I5 A$ x
      }, A+ R. O8 H- Z
   setTimeout('moveBall()',400);
8 p, T0 D4 n, @3 D: Y5 h   if (hidetimer!='')
! X# V  ^2 Q3 H, j9 c   setTimeout("hidetext()",hidetimer)6 T. Z/ _6 _- W3 k( K1 F
   }  j6 N, x: z8 j2 U# e

: s/ q2 D$ ?. B. I. z9 _function moveBall() {7 E. `: e* m# }2 ^, o
   if (superballRunning == true) {
  k# y( T2 F0 N1 M! H8 F3 i5 O      calculatePosition();
* P. ^) {( Q0 M/ H, Y, m      if (document.all) {, p! I4 P. W/ A% x% f& O9 O, h: u* s
         document.all("supertext").style.left = xPos + document.body.scrollLeft;# X. q( V% i) |1 }' l+ o9 K" m
         document.all("supertext").style.top = yPos + document.body.scrollTop;
6 Y8 O; C3 A2 u$ ?. e: |         }1 ^! K: _* ~/ s: @( v2 r2 z& {
      else if (document.layers) {2 g- ~* {5 y" _* o+ F
         document.layers["supertext"].left = xPos + pageXOffset;
/ @% [! f8 i1 i         document.layers["supertext"].top = yPos + pageYOffset;
! `1 o* M% ^' H' |6 m, {- m9 T' N2 R         }' L6 u' Y2 |/ ?+ W
      animatetext=setTimeout('moveBall()',20);/ U( Y) ]9 W$ H' @7 f
      }/ N/ K/ F" j& i# Z
   }4 U& [5 \2 M! V3 `! I

' F* P* P. G+ j+ ]2 J+ x: h# _; Ifunction calculatePosition() {% O: ]$ w; G. N9 k
   if (xDir == "right") {' a8 I; g  T4 S: ~' k8 e' S& E
      if (xPos > (xMax - contentWidth - BallSpeed)) {
) F- S+ h0 U4 g. [% k8 {         xDir = "left";
6 h9 O: g6 v7 {7 h9 }; V/ f         }
0 @  A* E" @% W6 m0 y$ Q3 ~      }" {  @( F" {5 z
   else if (xDir == "left") {5 r- K, H, X* _$ D' C, |/ l
      if (xPos < (0 + BallSpeed)) {
, H! V  D' u" d6 Q+ J" \         xDir = "right";- y% y9 J0 D4 S& b  [4 N% j
         }: H, E, _* ^- o6 j* c) b
      }
$ A9 w; e$ i* o5 c; \) i   if (yDir == "down") {4 u/ w$ K0 M/ b7 [) c
      if (yPos > (yMax - contentHeight - BallSpeed)) {
) \! J# [/ M% Y" ?         yDir = "up";8 g9 g1 Z& D+ Z: X& b! |
         }
7 _& L5 f- K6 ]% l5 h' [( }( A      }+ E1 ]- d" h- S/ l+ C( D
   else if (yDir == "up") {
8 L3 F* `/ |2 H1 P$ R% [" F      if (yPos < (0 + BallSpeed)) {: u. m' U( H7 ?0 x9 y$ Q* t
         yDir = "down";
2 a3 v$ G2 z. Z  l         }3 B  E7 h" |7 P; ]$ Q' g( j
      }+ X. e) O# o/ y7 T+ V
   if (xDir == "right") {% O8 {6 w6 X, {1 y0 H" J2 _% I
      xPos = xPos + BallSpeed;( f; K  i, N! B
      }2 K* j$ g# T% l/ L
   else if (xDir == "left") {" E6 k' K3 r2 S3 y, S  ]
      xPos = xPos - BallSpeed;2 ?) P9 z$ s7 l. Z# c; w
      }
3 s# P1 j0 B( k6 M   else {: s( Y( h" \2 L: x1 D0 u
      xPos = xPos;
6 L4 w" V5 u5 f3 M- e      }
, O* t0 j7 k6 @# Y- R8 X+ h0 b   if (yDir == "down") {* |) K1 B2 p% M1 V5 _
      yPos = yPos + BallSpeed;
, Y6 v8 {. Y9 L/ Z/ h9 D, W      }
: W1 t; {0 w. h: U6 U9 G! P   else if (yDir == "up") {
, _( c" P2 B9 S      yPos = yPos - BallSpeed;% s$ j& _% L2 {! G
      }$ p5 `! j! J* m- d! Y" [
   else {8 S) a  C5 J8 b4 j7 S# c
      yPos = yPos;( m; M) d- }0 S, [; |8 Q
      }8 \, {7 T/ R& H7 ]
   }
: k2 W' [9 x0 Q2 P7 m- {0 b  W4 B
0 q( l7 H. v% H. Afunction hidetext(){. @/ K, `4 u3 R2 e" p5 r9 T' @5 C: R& b
if (document.all)  h1 R4 C9 D! ]3 \: a) c2 d
supertext.style.visibility="hidden"- C9 B3 M$ S1 x3 l- {* ~8 V
else if (document.layers)& i9 X  W1 m6 o8 ~# ~) P
document.supertext.visibility="hide"% Z! a9 y0 ]; s6 r" U
clearTimeout(animatetext)/ |" v7 _% [( f6 K$ K- H
}/ ?. }! ?- w. \0 D2 b# g% r3 N0 I

3 r, N3 @1 F9 x) S! H( |" |6 gif (document.all||document.layers){
. k" D4 P. ?  P" A+ p* }document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')8 b' V( K% p, s
window.onload = initializeBall;
8 H4 M) V, y! O% p5 X6 jwindow.onresize = new Function("window.location.reload()");
- l) ?; n+ q+ @( s% {- v}" J) L6 a7 C( K1 O: |( @9 r* Z

" E- T8 I  p7 L( V/ W/ {</script>

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