返回列表 发帖

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

<style type="text/css">+ D1 G0 Y8 f( l" p  K5 y6 B
#supertext {2 u1 T- `3 c# p% C2 I6 @, `' H3 M, S. P
position:absolute;
0 _% ~" L& P, D1 y5 rleft:0;
8 p; Z+ B1 V9 e+ K1 S0 P& N( Z0 Otop:0;
+ q# @. X1 G% T3 w3 Tvisibility:hide;% |1 K+ j! ~2 k. }
visibility:hidden;
6 D( s; v( F- Q- O0 N* _9 u: k}
4 k$ ]! U5 |7 P0 f</style>
0 z! U6 d9 F* v+ _$ o6 h5 j$ K5 ^<script language="JavaScript1.2">
9 y0 j9 ^; A7 A  D) t5 V<!-- 改变下的字体的大小。颜色-->/ V9 e6 z4 B$ v
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'7 a3 a* {8 I  J# {- `
var hidetimer='';- o4 o8 Z* u9 D
<!-- 改变下的弹跳速度-->
* x. H' f5 D+ _5 {5 Mvar BallSpeed = 20;
' {) k$ X3 w0 f1 M) B$ R& Ovar contentWidth;4 J) h* S9 y! c+ K6 B( Z# r5 Z
var contentHeight;8 q9 b" W5 L9 Q8 w
var maxBallSpeed = 50;
  c8 M% w; E. Y4 u3 U: S# g: _, b, L7 p. T  f* t8 T7 H! I
4 L- l" w/ r, U) F) L& P# G
var xMax;
) w0 Y, W$ R! v5 n' q6 S: ]var yMax;4 R5 J  m  `0 V% W
var xPos = 0;# Z+ e7 J2 n5 G% ?+ F# D+ s
var yPos = 0;, O2 q& S8 s! w0 M2 j
var xDir = 'right';
) W& O3 N, }+ Ivar yDir = 'down';5 z" t- m; W6 C2 J, T
var superballRunning = true;
6 R: w, u6 Q( H: b* r( mvar tempBallSpeed;
3 {0 z: ]9 ]' }8 m% m; E" Lvar currentBallSrc;+ G$ O4 D2 M- j
var newXDir;
0 S# p' H* c$ k" ivar newYDir;& o: v. s  v0 I0 ^

( p2 Z9 p0 I. {3 Nfunction initializeBall() {7 d( N8 S: e  q- |  p( u3 c, _3 j
   if (document.all) {9 `" V9 ?/ o7 X& @  B! X; {
      xMax = document.body.clientWidth" E$ K0 z3 i/ I3 V+ i5 @+ k) e" v
      yMax = document.body.clientHeight( k! d( [6 U! h
      document.all("supertext").style.visibility = "visible";
: Q7 z' E$ s5 x2 I- Z2 }' F      contentWidth=supertext.offsetWidth
0 o5 N$ Y2 S4 P, S, e# n      contentHeight=supertext.offsetHeight: ?% ^/ {; Q2 G& e- n& e# o
      }! r( ?/ K+ o, J, `/ J, P1 K- ~
   else if (document.layers) {3 _6 I7 U" E8 H
      xMax = window.innerWidth;
# t$ N  \! d; X      yMax = window.innerHeight;5 w$ ~8 r# G. [! u9 ?* l* H
      contentWidth=document.supertext.document.width
, h0 f* e2 p) X1 G$ R      contentHeight=document.supertext.document.height- d3 U7 ~1 V/ x$ L9 m" H" K. |& M
      document.layers["supertext"].visibility = "show";/ w+ w7 `; B9 t+ |" v+ e
      }
6 n$ A5 n5 S! a5 {   setTimeout('moveBall()',400);  u4 H1 \. g" O. [# I4 E1 |# H3 {
   if (hidetimer!='')2 N0 I# M4 V+ j* C) {
   setTimeout("hidetext()",hidetimer)2 J% Z' j& J/ [' N4 l3 E5 D
   }
! C8 d1 `  M+ p* t1 P( I  \1 u: D1 ~- H* L5 V
function moveBall() {
, q: k- Z) M' H6 ~' y- B( B   if (superballRunning == true) {
0 b# {1 b1 v$ ]' m+ t; ~- F      calculatePosition();
/ Y* Q1 l' k5 R$ E: \      if (document.all) {
7 ]! A/ T7 P# s) a* L         document.all("supertext").style.left = xPos + document.body.scrollLeft;" C6 Z. R( F3 b0 S" E$ ~
         document.all("supertext").style.top = yPos + document.body.scrollTop;
+ i- z3 g5 D4 D0 ^         }7 S8 q0 t% E' D6 ^0 p. {% _$ P" H# h
      else if (document.layers) {4 E' ?7 W2 |' k$ f  B6 h. o4 P
         document.layers["supertext"].left = xPos + pageXOffset;
' [1 f. d& \: M, e! N9 f) V$ h         document.layers["supertext"].top = yPos + pageYOffset;
* x6 o$ M% `. q4 W: U: x" p         }/ f* F3 k$ D  Q5 j* B! P
      animatetext=setTimeout('moveBall()',20);
$ {0 n7 q) n# y" l+ T      }, }$ R( `" K* l& ?' x# `
   }
6 ]' m/ X, j! V3 H) W/ W8 m6 v* ?  V+ V0 M; c+ D
function calculatePosition() {
, \* G$ H0 ~( s4 z3 d! f3 `   if (xDir == "right") {
2 P+ s$ N4 X7 }9 [' H/ n      if (xPos > (xMax - contentWidth - BallSpeed)) {% w  j) @: a& A+ Q2 \0 L* P* @, ^
         xDir = "left";% s) O5 V/ w  Z$ A( j6 n3 d3 f$ X% D
         }
" H5 v4 T: q7 _$ Z) \* Y  X3 \      }
+ e- X! b& t; A% w4 G+ y+ n% k! z   else if (xDir == "left") {/ \+ f' D8 Q0 Z
      if (xPos < (0 + BallSpeed)) {
! H/ T& X* `. I% o: e         xDir = "right";
* ~: u/ V; N  T3 K- t# W. p# H         }6 `: I) Z' p& w/ I0 h% P& W
      }; z! J. U! o% g, h
   if (yDir == "down") {: }" q. _5 U5 C& ]3 a4 I6 e/ ?
      if (yPos > (yMax - contentHeight - BallSpeed)) {5 @  Z6 |- t) {9 I3 w6 s
         yDir = "up";
2 G  P# D+ Y0 G+ m         }3 a( C& `) k- T
      }
/ B/ a7 C2 Z- W+ U   else if (yDir == "up") {
+ g. m# I: W( J9 a; Y) t& c$ M5 n      if (yPos < (0 + BallSpeed)) {
2 S4 H2 \' @: |3 E5 i         yDir = "down";7 m, o; _, w. ~% [6 @9 p
         }
: l& A/ j/ ]9 y" U" e      }
% N0 ]) ?! Z4 ~) C) f   if (xDir == "right") {+ m" S- n8 S# g# A  t! A- ]
      xPos = xPos + BallSpeed;3 q" b! C7 }8 \+ R
      }: W! Y/ o) t! k! N
   else if (xDir == "left") {
0 r, j* [& g0 P) q; p! E. ^+ n+ [, R9 [      xPos = xPos - BallSpeed;
( c' {9 r4 u8 ~  G      }6 K6 e, M9 ]4 u8 U2 U
   else {
, H( D" Y* d+ s. n: J8 O0 ~# Q      xPos = xPos;
5 O  B$ D; a2 v      }
! j4 f1 c% y) }& U   if (yDir == "down") {
1 z; r" l9 m7 h  A      yPos = yPos + BallSpeed;
$ f% T/ t1 q' |      }6 T9 h" N) E  M2 }$ Y
   else if (yDir == "up") {
5 L0 V3 S* J3 k. ~% F      yPos = yPos - BallSpeed;( ?1 c7 B! W& v" q
      }
1 j1 h2 ]9 U* M8 B4 }9 @9 B   else {
6 ?) r. a1 n! q2 _2 R      yPos = yPos;4 }, Z- w' M2 s8 D3 x5 f! V5 p9 a; d
      }
' x( U* D: }1 ]+ h; q   }0 s- t; s/ }" m6 N

" `8 W7 T0 q. M) o% _9 _function hidetext(){. M8 W2 L+ \9 j) {* E3 \
if (document.all)
  O( k- D  b" A( A# I/ ]# }: ysupertext.style.visibility="hidden"  b9 ]: E  \# Z& \
else if (document.layers)
" x5 R5 T# @" {- ~7 A9 Zdocument.supertext.visibility="hide"
4 \9 d+ _1 K( @; H& iclearTimeout(animatetext)
1 c+ V" S* \& {5 @* C# G! T}
- f8 {6 V6 P, d- D4 [8 Z/ @8 z# m) d  @
if (document.all||document.layers){
# b, ]3 F0 x' z+ g& Ldocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
5 Z* h: j8 Z/ F9 w; Uwindow.onload = initializeBall;7 C; k' h9 i' g; A% [
window.onresize = new Function("window.location.reload()");- J/ M& s( V7 Z2 a0 }4 k! B7 \9 y
}
0 j. Z& R$ Y: W: \: @5 ]$ x- q9 `0 x' S
</script>

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