返回列表 发帖

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

<style type="text/css">
; g: g6 T% p5 g% k: x) e#supertext {
/ z2 z: d( u5 ]" G  m" ^8 |position:absolute;# i8 J8 p4 T$ u5 K3 \0 u
left:0;
4 |( c$ T( ~- ~( n% ltop:0;
' r% M: S$ g4 o+ cvisibility:hide;
% j: b/ @% `" D7 o  [visibility:hidden;
) T7 z4 b# q* O6 L. h1 h; l0 P$ M" ?}
; I5 g1 W1 I; U</style>) {4 N/ E: F# X  J  q# ?1 j/ |
<script language="JavaScript1.2">
8 p3 P5 U" ]5 I# o" e<!-- 改变下的字体的大小。颜色-->
0 o; `/ h/ Q$ ovar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
* [( Q6 q0 c1 c% y/ ^# h% q( `var hidetimer='';* N/ e5 f2 T/ d3 u1 ~2 Z- y! Z: a
<!-- 改变下的弹跳速度-->
, H) Q5 \. z0 b% Ivar BallSpeed = 20;3 T; i  L# \1 g) s6 k
var contentWidth;8 c' v% g# n: D+ |0 i% j  S
var contentHeight;
5 Q. \7 q8 I" r2 W, t- jvar maxBallSpeed = 50;9 ~' D% a0 \& S% ]# U  `) }
5 O& x  F4 ?; p9 i$ q' k

; A2 I/ i) c% q* b3 m! V% ]# a) ]var xMax;8 }7 i" {+ w  L7 \, ~6 C+ Q
var yMax;& I/ [& l. D. m2 r1 K# o
var xPos = 0;
  N: G. D# D/ i  D  Y( t; ^, V$ Jvar yPos = 0;
5 L9 r4 \2 g! m8 B# l4 f$ x, Qvar xDir = 'right';
: P) t5 _  r' ]% b' Q/ x" Q+ O( c  rvar yDir = 'down';
4 z  v! u+ P% y! mvar superballRunning = true;  p6 v( n$ D+ e" q
var tempBallSpeed;+ Z; A8 A# J9 O$ H4 _
var currentBallSrc;
, }4 V5 C8 ]# z& Z' |6 `& _4 l$ t7 \7 jvar newXDir;
/ l+ @4 b- h7 w* xvar newYDir;1 b; O7 g0 u+ T9 |
0 a2 \( j$ W" E4 [
function initializeBall() {
+ V0 {+ R( P2 \' [& z" K4 X# ~   if (document.all) {
& a. w+ y+ l  a' r6 D' |      xMax = document.body.clientWidth5 t0 n0 _- [$ M; w- e  z" q" G
      yMax = document.body.clientHeight+ r9 \7 Z2 O- v5 o
      document.all("supertext").style.visibility = "visible";1 }, t) x$ b2 C$ a; f" C
      contentWidth=supertext.offsetWidth0 m: w8 b- L3 D( ?8 w
      contentHeight=supertext.offsetHeight
' D+ v+ p# b7 Y4 W  D/ @0 o% h      }5 \2 h  p* T4 v
   else if (document.layers) {8 L0 U% w) }* L5 I+ z
      xMax = window.innerWidth;
% p7 M% T( F1 \6 E      yMax = window.innerHeight;" y0 J) z2 g/ N) Y
      contentWidth=document.supertext.document.width
6 ?; L- H! U% J4 d      contentHeight=document.supertext.document.height  R4 k* W( T, f' J' I% H
      document.layers["supertext"].visibility = "show";6 X1 @. R8 x* f# a$ _
      }
- ]6 G0 w; B( \2 v7 ~   setTimeout('moveBall()',400);, B. o. C4 M* M2 k
   if (hidetimer!='')
: H9 A$ W& l0 ?. X4 V  R. R4 N   setTimeout("hidetext()",hidetimer)3 `$ k/ @3 e, ]3 m- E
   }
+ p7 j/ f/ ~0 e# e5 r& Q3 a) q, D8 k. a9 o$ f5 c- Y* F' P! F
function moveBall() {
: \/ V& k% n' v# b( I   if (superballRunning == true) {
, z! B) ^- @% `      calculatePosition();" v* d+ X4 _/ u# ^; C
      if (document.all) {# N- y" d* M: X! I' q( E, T$ m. ]
         document.all("supertext").style.left = xPos + document.body.scrollLeft;1 i0 ]0 L* e  L' W, j: Q" A
         document.all("supertext").style.top = yPos + document.body.scrollTop;
% e7 b: _/ Q; U5 l5 S         }
* H1 M( ~) X$ K; s8 q& Z/ i      else if (document.layers) {
0 z) Y, W5 Z6 L& n& I/ \* V; V         document.layers["supertext"].left = xPos + pageXOffset;
9 }" x4 n! X8 d- K1 c* c& v         document.layers["supertext"].top = yPos + pageYOffset;5 n8 R0 D6 T0 Y# ?1 k/ x- W
         }
. U6 q5 D" [% O2 d2 C" c9 q      animatetext=setTimeout('moveBall()',20);, L$ n+ w5 D0 X5 Q
      }% I& R* g; ^2 P& r( t9 a2 w/ ~
   }
# Z) j! ?5 C' Q: F7 K
/ _' `9 x3 l: ~3 S$ E" nfunction calculatePosition() {
! e- b5 n) w  C9 e! ^   if (xDir == "right") {
: y. ]- g$ K& H& N: ^' `      if (xPos > (xMax - contentWidth - BallSpeed)) {* }9 Z) ~) s1 R% z( p
         xDir = "left";: T) N. N7 }( M- r& x; L: W8 e. n
         }
1 L5 @& R6 y2 F" z      }' U' X( l0 d0 A0 @+ x+ \1 u% p$ E' b
   else if (xDir == "left") {' C; ~" P. u; ?9 w- C: }( N
      if (xPos < (0 + BallSpeed)) {  b  D3 I& i; F$ c0 B
         xDir = "right";
' H9 _" R& Z' a' L* Y         }7 u5 h+ f+ _8 @0 ]! F% k
      }
& v2 P+ H% r) j0 S# T& j: X   if (yDir == "down") {
' a7 B7 L& L  r9 V* m9 e      if (yPos > (yMax - contentHeight - BallSpeed)) {+ b/ o9 L( |. B. g
         yDir = "up";9 Q, O5 H  ^9 O* {
         }
6 {4 x- }0 T+ I: W- a  o; U      }( o# q8 o3 \4 J# P1 T
   else if (yDir == "up") {- |1 a9 Y; |9 Q4 O9 d6 W# W
      if (yPos < (0 + BallSpeed)) {: G& j4 F! \( O
         yDir = "down";
5 @" F3 ]9 ~7 H; {* M- w. t         }, X, H2 P' j! {# ~  d/ p9 M
      }
/ g4 j3 p6 y' u9 r! F   if (xDir == "right") {# ~: p+ z& ?2 H- W$ `
      xPos = xPos + BallSpeed;) t3 s, C* |% Y# o$ X; ]. `
      }
5 [2 r6 O# ^9 m- _$ S6 i9 Q  B; Z   else if (xDir == "left") {8 |, {: |8 @$ d/ S+ \1 {( s: d% l
      xPos = xPos - BallSpeed;
9 }% }2 ]1 ^( K- a6 D0 d1 }      }
# b# k+ C+ S" P% L   else {9 `9 a" ^$ c) Q% I0 r4 c/ ^* U
      xPos = xPos;
4 a/ ~) e) P, D      }/ W  a+ h+ Z' `+ |  F3 E1 F7 s
   if (yDir == "down") {) c' h6 l+ n, w3 }; m
      yPos = yPos + BallSpeed;
/ u: g( [. p  W5 C, r      }
+ ], {5 b2 v5 U$ T: Y   else if (yDir == "up") {& p: Q0 Z, S) Q
      yPos = yPos - BallSpeed;8 M4 o1 h- c' F' j" ^
      }  x5 i, J) W) b2 W0 I7 ]
   else {
0 B8 _3 V; y4 y& ^0 x# a      yPos = yPos;
0 @1 W) T, n1 |9 ]5 N( S4 K1 z7 Q      }
% E& q; w1 v: ~$ _$ \: g   }
6 c5 W" y' k1 v9 y2 ^6 |6 K) b" B! ^
function hidetext(){
( g& i* Z9 t& S+ e1 K' `) qif (document.all)
/ Y2 c. K' U. L$ U  L1 Hsupertext.style.visibility="hidden"$ v$ f% B+ J4 ^
else if (document.layers)( [- E9 m+ F# ^5 a& ]2 q  h4 J6 K
document.supertext.visibility="hide", \4 ~! h1 G$ p6 G, S4 f0 z
clearTimeout(animatetext)4 ^3 q2 H( p1 ]' O8 p3 `" w1 v; Y
}
, `% |, Q  g% s: t. I/ v7 N9 w& x3 W$ J. K- W  q
if (document.all||document.layers){: ?; Y) v4 D3 W
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
8 `6 j, d! b. |! Hwindow.onload = initializeBall;& F  f0 R" v: _# h3 K
window.onresize = new Function("window.location.reload()");* }. H2 L1 @4 M. x
}2 i. ~4 p5 h! Z  q0 _- T

& i* R( t: K- S* H( ?* Z</script>

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