返回列表 发帖

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

<style type="text/css">4 k$ }5 {/ r) _, G$ X8 {$ J' _
#supertext {* K8 ?, o' ?8 m3 d& ?) S
position:absolute;$ n! B0 x  S$ t/ ~
left:0;# {  \2 r. D9 h" ~2 J8 J8 R
top:0;
- J+ f0 R" a$ f. w% p0 ^0 Jvisibility:hide;
; J0 k, z0 `  z( evisibility:hidden;
7 ^6 t' U& f6 U}
& n& z  \! ]6 \. p0 f7 z</style>6 p5 E6 n7 d  {# v  V; ?
<script language="JavaScript1.2">
& h0 D8 _4 s9 a# f/ z  n0 G: ?6 D<!-- 改变下的字体的大小。颜色--># I. c0 O6 c* G* C9 o( G
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'( v. k. T0 i5 K
var hidetimer='';
; W. }  c, b& O- F3 a/ A2 d, G) ^<!-- 改变下的弹跳速度-->: F8 i" S' ]1 t% @; l, [
var BallSpeed = 20;
) T' _2 }7 h8 A8 u  Hvar contentWidth;
# A: ]; u" C' Q5 [var contentHeight;* p$ |: Z2 |- y
var maxBallSpeed = 50;
* Y& b1 ?. m( x- I
5 S% M: ~8 i& `9 B/ R. x; C/ c) @' R7 J) j  H$ g
var xMax;
! _) ^1 V; |, A* g6 kvar yMax;: T* }3 R3 x# X: w6 G
var xPos = 0;
0 M. g% e! l3 A9 xvar yPos = 0;
, E5 G% l3 k- R3 m' }2 B! H9 g* evar xDir = 'right';
' Z0 R4 P0 t7 s* k! svar yDir = 'down';
5 q) ^9 u% B+ C' I6 U, r3 Tvar superballRunning = true;9 F2 f* O. ]5 K9 ^) }! L7 \+ i% v
var tempBallSpeed;
7 S8 w/ _5 O, x9 P" D% Cvar currentBallSrc;
2 E; k6 r* c' R2 Q9 X, j2 D2 tvar newXDir;9 X0 h0 [8 g" v  t$ a9 G6 h
var newYDir;, N" p& P' d" Z; k

8 c3 f9 ~( z1 V- i. Rfunction initializeBall() {) x7 Q/ N: r# D, o" E0 Z9 r: \! Q2 K/ ~
   if (document.all) {; A9 y9 v* H8 i- ]8 ^! M
      xMax = document.body.clientWidth4 u3 O( r: n  k1 s8 k+ A# m
      yMax = document.body.clientHeight
  c, l; e( v7 v5 ~! ^) v' w1 }% y      document.all("supertext").style.visibility = "visible";
* c+ `1 j% K, `; F$ e4 W      contentWidth=supertext.offsetWidth
; l3 Y& M& \* G+ E: H      contentHeight=supertext.offsetHeight
' c( n- U( R* g0 Q      }9 }' t' C( f9 Z6 `5 T, u, ]
   else if (document.layers) {
2 f& a6 X, n- z      xMax = window.innerWidth;+ d# x9 t: u, q+ K& W/ j/ B
      yMax = window.innerHeight;
3 o  U$ h, S+ p* G1 }/ _3 ?- e      contentWidth=document.supertext.document.width  z! A. Q8 D+ k: b- R" s
      contentHeight=document.supertext.document.height, A; p7 h2 X) H/ h1 f$ L" e" t
      document.layers["supertext"].visibility = "show";
2 F2 W. L6 R" R/ Y8 C( u" X      }+ A% a9 ^5 ^0 n
   setTimeout('moveBall()',400);6 z& H5 W% T+ f  H& T
   if (hidetimer!='')" T) @! n# X7 a' i3 R" b
   setTimeout("hidetext()",hidetimer)" F1 R5 K; Z0 F/ @' X
   }
- w; P8 g+ r! c0 @- i/ T  G5 e+ @  W% i( Y5 O- h# @3 E. J; m6 ?* n
function moveBall() {! o/ H. Y4 t9 V
   if (superballRunning == true) {
) }. T: P0 E9 l! f9 p, _      calculatePosition();
+ _9 w: u* s% s      if (document.all) {
% N$ {$ Z: p" i+ C         document.all("supertext").style.left = xPos + document.body.scrollLeft;1 U! C! f" h2 H4 {1 U2 O- b
         document.all("supertext").style.top = yPos + document.body.scrollTop;* n+ F$ V4 ]$ }
         }
6 f0 U3 O2 o) j# n. a8 B  h      else if (document.layers) {. t& M) r; M: S/ z( Q; s8 |+ R
         document.layers["supertext"].left = xPos + pageXOffset;6 s/ q( m1 }$ d8 m. y! ?
         document.layers["supertext"].top = yPos + pageYOffset;
, ~) M& ]$ S; @! \1 s# ~         }+ z1 @. |* t( X2 H. ?
      animatetext=setTimeout('moveBall()',20);1 ^3 V4 Y1 j# d4 a" F: ^
      }: p) V8 \+ V( V7 I& J; q# _; Q
   }
& w. u. k: y' G2 U: T6 M
% T: ^& Q2 @7 U; jfunction calculatePosition() {
' `0 L1 n' x2 e  |) A+ S4 U   if (xDir == "right") {
* k) K0 r, b; X6 j      if (xPos > (xMax - contentWidth - BallSpeed)) {$ t1 Z: k* V# H/ _) l
         xDir = "left";
% W4 S; r. P9 g7 X& x& K         }% t, ?' ~3 D1 _* h4 j) @* x9 S6 P
      }. i  M& x1 z' Q) Q+ b! y  U
   else if (xDir == "left") {) f/ c$ I; d) E: d; N4 Y$ t
      if (xPos < (0 + BallSpeed)) {1 d2 `" `: o4 \2 ~: P
         xDir = "right";
) i& f9 O( v8 e) j) y) A         }- Z1 M# m" }$ u% s2 d+ t0 l) q& F
      }4 U& j7 @* i, m# z, V/ }- \
   if (yDir == "down") {
0 u/ y* P: A5 u' w: v" }- R. A      if (yPos > (yMax - contentHeight - BallSpeed)) {
9 X7 k" {! \& R7 z  B$ }         yDir = "up";
- L" D/ t6 n) O1 f1 T) S         }5 [* B2 F3 o" w3 Z! g8 z
      }, j. |: D; {* O/ R# `# }* q- x" h' s1 e
   else if (yDir == "up") {
" a4 a/ j( I, M1 F" k  p      if (yPos < (0 + BallSpeed)) {) y+ a! C6 U0 R- p, b1 R: Q
         yDir = "down";/ B4 h, I" `+ z' w
         }; V' `6 n6 H, E! M% K# P
      }
: n/ L! y; f+ f+ N3 _" x1 @& Z7 H   if (xDir == "right") {# t) L+ W* J& |5 e+ P
      xPos = xPos + BallSpeed;
0 G) j- [. U% ~- a% O3 c; m      }
8 L1 v, C/ T, O; Y! a   else if (xDir == "left") {5 L" a, l1 U$ D+ p& ^/ p; d+ ^" C
      xPos = xPos - BallSpeed;
( H) Q2 ]1 n8 S1 u- O! Y3 {* }      }
2 ^! r9 L$ f- T, I/ w1 ]: J   else {+ {9 t3 f  w7 Y; z7 p- r
      xPos = xPos;# X0 W) g7 x; T, R$ t
      }
2 x# c( f7 _1 f- p   if (yDir == "down") {* K7 L) U+ l- j+ W+ p% H/ C
      yPos = yPos + BallSpeed;7 s, f0 N2 H. d+ z# P$ \
      }5 p) p3 A3 y7 w" d, _7 T  V# A
   else if (yDir == "up") {
0 G: F0 Z& J+ b6 L2 J, @9 a9 j1 [' B      yPos = yPos - BallSpeed;8 Y2 T; a4 l! |6 u  W4 ?' w
      }
! T' I7 A* f. `4 g, n, ^   else {
: c" P% C; _( T( w9 f+ i      yPos = yPos;
. o1 i3 X% C' V* v2 Y* k/ d      }
, k. T9 k+ E( s# U5 A7 v. ^   }! P, `! \9 F! J$ Z) s0 @: v
; {* g9 \9 ?8 R4 @6 B  P
function hidetext(){# S, {: O2 j" @
if (document.all)( T" i0 @& q, p7 o; f0 Y# G0 B
supertext.style.visibility="hidden"
& S) S4 z* ^! kelse if (document.layers)
, l3 S2 W* P5 N9 Zdocument.supertext.visibility="hide") M* n$ n& p  p" @
clearTimeout(animatetext)
7 D/ c6 R) c+ o* J" n}
5 ?3 N! h( j5 `! |4 t0 i( ]4 L. b6 k2 J1 V" o; a
if (document.all||document.layers){! Y" N7 m9 ?* ~7 @  a3 d/ u
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')( A. I8 B5 U( B1 E2 C
window.onload = initializeBall;
2 `7 D; e: E/ m0 Wwindow.onresize = new Function("window.location.reload()");) ^$ \* C! T7 d9 v3 W) o& O6 ^
}3 G! u0 W: a8 f5 P3 s/ D" h$ q

# e2 h- C' ~7 f4 S  s" P2 }3 L</script>

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