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

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

<style type="text/css">
4 u$ S$ f' y$ x% ]% ^+ z) z6 D#supertext {! m  r5 J. b+ p; O' ]! j
position:absolute;: k, C, a! ?% \% W
left:0;% Y$ H* Z, S+ G4 K$ w* v
top:0;
) R4 |5 a! Q4 }& k9 ivisibility:hide;# ?$ e* U+ r  {/ K
visibility:hidden;1 J" V/ e& z% r6 f1 h% g
}
- h$ g9 f  v9 p  r9 v</style>) [5 Q1 D4 d+ W5 j' s
<script language="JavaScript1.2">% L% z7 j% ^1 k/ v+ D0 i& o: D
<!-- 改变下的字体的大小。颜色-->
; Z" l3 D; ^, R6 Ivar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'7 @2 I' B. J0 G5 D+ }" t
var hidetimer='';
% f* w2 t$ Z6 Q$ d" W9 h<!-- 改变下的弹跳速度-->; B1 M2 n2 O  B# J
var BallSpeed = 20;
) I1 W8 c' z* Vvar contentWidth;
- H# c) e3 v, I, z/ n* {var contentHeight;% t0 G3 O1 N' D/ @( ?- G
var maxBallSpeed = 50;
, q( h0 R% ^3 C3 U( y4 Z$ ]
  {. K: X$ b: G
4 Q# j/ k6 Q2 R: bvar xMax;
+ Z' z; j, Y4 A6 U/ M1 u$ avar yMax;+ v, m- k& ^3 X: `! U
var xPos = 0;
8 S& u0 Z( c' o# n/ I# a9 S3 S* @var yPos = 0;
* Z% C( P3 y. p* {1 B# Kvar xDir = 'right';
- {6 O  |  t3 a% R# s- I% m& Fvar yDir = 'down';8 U1 \0 y! G0 H6 X; G
var superballRunning = true;
% w' Z) H9 S- `# ^1 \; Hvar tempBallSpeed;3 b6 H1 \6 R5 o2 f" o9 D7 a# P
var currentBallSrc;9 `: Y2 y; K+ M3 R9 I7 ~/ ]
var newXDir;" {3 m& |# {( h# H, P
var newYDir;, ], K3 d: B. T* P+ J% Y
; g* x! ~6 u' ]0 F( w9 J/ X0 f3 j
function initializeBall() {
* q1 }1 Q6 E& i+ z/ ]0 s" R   if (document.all) {4 x2 u) c; t& U! E6 P, L6 B$ t% o
      xMax = document.body.clientWidth$ H( _/ J. z$ m* d; C1 |
      yMax = document.body.clientHeight
3 o0 ~2 ?8 G- ~  y      document.all("supertext").style.visibility = "visible";
9 k1 u1 O1 N9 m! x* c3 y      contentWidth=supertext.offsetWidth2 [& ^+ @1 M7 ~/ d; G5 X
      contentHeight=supertext.offsetHeight! D$ p2 D' w- t; W3 x$ y, @
      }: T8 \6 w: ^- a5 @* y
   else if (document.layers) {
9 f. M: U+ g8 `. j      xMax = window.innerWidth;
( A9 N5 j! K2 H/ A6 h& a! R$ v      yMax = window.innerHeight;
/ S1 R6 S; X8 _$ J1 F3 C: J      contentWidth=document.supertext.document.width
, X( E+ E! \7 w) F, r/ [7 f      contentHeight=document.supertext.document.height; Z/ ^+ v6 p1 W
      document.layers["supertext"].visibility = "show";- X/ g2 n, q6 [7 V$ f
      }
) }0 e1 M; o* f/ S. v' L+ B' j   setTimeout('moveBall()',400);4 p) H, M% [( C, n; ~% U6 ~
   if (hidetimer!='')2 t! w+ L7 R, t
   setTimeout("hidetext()",hidetimer)/ O& n6 F: f5 r4 w1 k. k7 k
   }
( J. u1 p  a; H. P) U
9 ~: i) h8 ^9 s; J, v% r. c6 hfunction moveBall() {* b' t6 u( q0 J( D8 A$ c" r8 f: F& B& e
   if (superballRunning == true) {* J" }, ?3 [, G
      calculatePosition();
: G0 M0 F" h% H3 I/ C7 a      if (document.all) {
2 R" h/ L; J) Y, a0 x& u! [* @         document.all("supertext").style.left = xPos + document.body.scrollLeft;7 k% i7 u6 N* A  @  S
         document.all("supertext").style.top = yPos + document.body.scrollTop;
; V( P6 d5 H  Q9 q+ l  I" G; L         }7 C" p/ V# G) K  E5 \( L: Y6 Y# m# E
      else if (document.layers) {, j4 Z" ?, o! z% U4 L
         document.layers["supertext"].left = xPos + pageXOffset;& O' L" ^) Y) s: Y
         document.layers["supertext"].top = yPos + pageYOffset;
# ?# Q; l! A8 G; }; |         }
. G# J0 P3 U$ r3 I! Y. R  a      animatetext=setTimeout('moveBall()',20);7 w( s& V! |4 \9 A# H
      }
+ r4 L& o, N0 u8 ^" p4 G/ O   }
6 X1 |+ s+ I" o" T. U2 a2 i( h- x7 w% S: s
function calculatePosition() {
5 T9 A. N3 v( o7 }, _) @! H   if (xDir == "right") {
% `) {4 P$ P8 D: o5 ~6 r  q5 {1 i      if (xPos > (xMax - contentWidth - BallSpeed)) {
$ m* o. V, \0 }$ ~' S7 s3 ]         xDir = "left";" L( ]$ _9 s; i5 q
         }
1 d5 ~2 U) l) z7 q' ]) I* @      }$ _. ]; w* D/ A* m: s
   else if (xDir == "left") {: ]* W" t( @& y4 V, W$ S
      if (xPos < (0 + BallSpeed)) {  A2 u) R+ x6 e! N2 [
         xDir = "right";- j, R9 M& n$ e$ b; ]% N1 p4 k
         }
3 G9 W6 e( Q( `# f3 W6 g      }* L: P+ m0 ?# Z8 s% [
   if (yDir == "down") {% B. v9 H* O! e6 u: F  y
      if (yPos > (yMax - contentHeight - BallSpeed)) {4 i% w7 o# ~7 K) J
         yDir = "up";
8 G. A3 U/ o) |% J" u, _3 A" |         }/ f, v3 n5 ~& F
      }
/ m' @9 r2 m: H* f( ?6 Y5 v   else if (yDir == "up") {, ~6 C, t$ k; S% Y- L' D
      if (yPos < (0 + BallSpeed)) {
" P) u+ V+ ^9 N; W1 z1 l         yDir = "down";
& @: Z  T% W$ c& @. f8 i4 |         }
7 b) C8 _8 e$ L( k' c& K7 Z      }
: D) ?# I* m& |$ W( P3 l" [* _   if (xDir == "right") {
3 f: y0 n1 _; m: P% u      xPos = xPos + BallSpeed;$ W, c. X2 t  Q' b
      }
. a6 q$ \4 O9 J0 m9 B( i* a   else if (xDir == "left") {: k+ m. d8 G) p! Q" ]
      xPos = xPos - BallSpeed;
0 D+ d2 Y0 i8 w, {' [* J      }# q2 e: P6 Z  ]! [/ j, l& j5 g
   else {6 z' Q% q& A% L: e2 C
      xPos = xPos;5 T- |* D5 z/ u3 j5 }; V
      }
4 Q: ]$ E0 S0 [9 Z5 ~   if (yDir == "down") {& e( l9 o  |4 ^  ?3 o
      yPos = yPos + BallSpeed;8 L- D! G7 u+ @* C
      }
% V0 J# q6 J" X/ y   else if (yDir == "up") {6 y! _5 }1 t1 L6 E9 a
      yPos = yPos - BallSpeed;
& L) B. J  |% \: W9 S      }
  o% V" c8 o2 J$ {+ z- \   else {: o5 A0 }) t4 ?+ ?9 d& |
      yPos = yPos;
0 _6 f! y) l* j! J5 @      }
7 i/ w" T: h3 ~& {   }4 ?; a2 z) Z4 v- O8 {

( {7 |5 N5 x9 J; Cfunction hidetext(){, |/ P1 F' l2 {" I# P
if (document.all)9 y! t* y; |8 P, M
supertext.style.visibility="hidden"
2 [3 S" q; i( y3 P3 }  h; yelse if (document.layers)
% x+ Y+ l( s4 W- b0 k' Ldocument.supertext.visibility="hide"
3 c  U7 f. Z7 ?  K3 @/ i4 FclearTimeout(animatetext)8 A; d2 G1 l& r# A& }+ a
}
" ^- w# e/ Z2 E5 Q" N4 S7 f8 p+ G9 c1 F" \3 |5 m
if (document.all||document.layers){+ u9 H5 ~/ S' e
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')" O' T7 b) d; q
window.onload = initializeBall;
3 t, W& w: _4 N3 m0 n1 J; Nwindow.onresize = new Function("window.location.reload()");8 l8 K( q: ~' I3 {
}
( y5 H. g6 ^0 L2 y4 U
' [) ~' @* O; T$ L: t</script>

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