返回列表 发帖

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

<style type="text/css">/ }& _9 v9 n8 R' J* Y
#supertext {
) I1 g0 ^3 x* y4 `: }8 [) r1 ~+ ^position:absolute;
5 k* H1 l, d1 n# b8 eleft:0;- k/ i/ O% M$ M& Z, L, t
top:0;
& Z! ^! Q3 c  O. zvisibility:hide;
7 z' W5 ]7 C' T' i! D  t9 o- P' ^visibility:hidden;
  z# }) u  j3 m( M}
" m2 z) K. R2 l5 m1 g. \</style>
; u9 K+ h' J1 E) g- Q% _- j<script language="JavaScript1.2">4 B+ Z' t7 k; e  `' w) x/ ~
<!-- 改变下的字体的大小。颜色-->: e3 I2 T6 `7 m1 e
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
# ?8 o9 S/ @! `0 I" q: n" X; Svar hidetimer='';5 I0 z* q) w5 L9 z
<!-- 改变下的弹跳速度-->
" T5 l$ ?; ~, g. G, I) d! X7 b9 ovar BallSpeed = 20;
7 G0 ~: |; ?. \( w; Dvar contentWidth;; v' s/ B, P/ w! v6 B* a& K; H5 D
var contentHeight;
8 K) q3 A8 S# |+ c% Avar maxBallSpeed = 50;
8 m6 ?. H/ C, J7 k5 g* W, W$ L0 }  g5 \' z  [! Z
( M( R9 R1 O: F9 S
var xMax;
& _! l' g0 z6 l1 T- P! c% u- C4 Lvar yMax;
# [$ `: ]4 U' E+ P+ `var xPos = 0;
) J6 T+ ^7 {  h, U. e( o1 tvar yPos = 0;
: Q  d2 {/ U9 s: c7 Z1 g4 ?: H* Uvar xDir = 'right';
8 V& i8 S) S( Z  t' ^7 Nvar yDir = 'down';* i" Y7 P! R) y, s9 z0 b  e) z
var superballRunning = true;
: I' }& O* |  ~  jvar tempBallSpeed;9 K. u  D0 U# {( d1 H0 h
var currentBallSrc;
) X( i3 [; ]  M$ Rvar newXDir;: u% {) z. X' y* x6 z9 X
var newYDir;2 r, \. V1 ]( \* R+ c0 E

9 f8 i3 t+ B3 U" u: h1 z9 ^function initializeBall() {: `/ Z* Z( R/ `
   if (document.all) {
& z# W5 C( E/ V) \4 V; _" f      xMax = document.body.clientWidth
- o9 b1 c4 Z( X8 c4 m- S* t3 |      yMax = document.body.clientHeight& z8 E7 F8 B+ t  `& B* }
      document.all("supertext").style.visibility = "visible";
# `; w$ j& i' Y6 D. ?" h      contentWidth=supertext.offsetWidth
; Q/ }9 P' d4 @3 [4 S; a5 _, u      contentHeight=supertext.offsetHeight
# G, v' p9 S0 A5 m7 H      }: ]/ T7 L; `$ j! h' T
   else if (document.layers) {& `/ m: X# _' C, l) C, R  [
      xMax = window.innerWidth;+ \% c. o$ L) H% G3 n! x
      yMax = window.innerHeight;1 {# v* ^/ E& h& _
      contentWidth=document.supertext.document.width
5 u; l$ F* }: N$ N+ \      contentHeight=document.supertext.document.height
- d" R0 h% Z) A- {! d9 C      document.layers["supertext"].visibility = "show";" V7 O/ h, H$ ]6 k' Y
      }1 g- s' c7 B$ j; J+ ?
   setTimeout('moveBall()',400);
% D7 Q8 Y" u" m. c+ R   if (hidetimer!='')
' {  i- q* g) d; Z0 Y   setTimeout("hidetext()",hidetimer)
' c3 }+ m) K& m8 B   }
+ S: V8 h" U' x5 [: m/ l; y. j" V  J0 d. `8 r
function moveBall() {! ]/ w/ \( M6 n3 f' f
   if (superballRunning == true) {
" j3 e" `* M+ \      calculatePosition();
( v0 m  [9 `+ S' _. i& {* @( f3 G      if (document.all) {& f" T' p! [" ]5 ~7 I' b* w. f, d
         document.all("supertext").style.left = xPos + document.body.scrollLeft;7 H2 `; o) w1 v3 F. F- T6 o# M
         document.all("supertext").style.top = yPos + document.body.scrollTop;% ^( s* @* R9 L. k. s! _
         }
6 }" L# ?8 a* w4 ?7 z8 o) [      else if (document.layers) {
' ]# ^7 J8 J/ [+ Q3 t* @1 _         document.layers["supertext"].left = xPos + pageXOffset;
: M+ F7 G* ~% d0 e# }% O5 G         document.layers["supertext"].top = yPos + pageYOffset;
- f0 ?9 H6 q0 d+ c# R. z3 @         }+ v+ S' V$ p& G  N" w
      animatetext=setTimeout('moveBall()',20);
) V  I4 z6 V2 I1 G/ w8 ^7 U      }* A) V6 ^! q; h6 s
   }, z7 P4 H# C7 [  Y4 {# E/ @

2 l5 k& s. Y) S; R/ tfunction calculatePosition() {
3 N+ T2 w+ n$ n   if (xDir == "right") {, N; K, O) M- {' [% k- K
      if (xPos > (xMax - contentWidth - BallSpeed)) {
" @. l. F4 q5 Y1 p/ U6 t         xDir = "left";
/ v8 I) x# s5 M$ Q8 R: w         }. ~! a+ n  q! g
      }# B* W* s; L. d  p
   else if (xDir == "left") {
" H2 x3 I  M1 p* S5 o6 _2 h0 V7 l8 M      if (xPos < (0 + BallSpeed)) {
3 t1 ^0 l7 P5 k9 e         xDir = "right";( M8 J9 s4 L  x0 k
         }8 ^( H' Y+ P" I5 `+ H3 ~
      }" A7 [4 n& G4 h# i% L# O" ?1 v
   if (yDir == "down") {: @4 \1 u2 t( ^* K. O/ w
      if (yPos > (yMax - contentHeight - BallSpeed)) {
  U3 n- I, t5 j. `' x3 F% x         yDir = "up";. t" x; J" {8 I+ ~/ J  Q, r
         }
$ ^. Z( w' I" b" B# S0 T6 Y0 q1 C      }/ ]- z( z$ F+ w0 A/ ?* N
   else if (yDir == "up") {
0 y! ^4 N8 \! ]' O7 \. n+ t      if (yPos < (0 + BallSpeed)) {
; y% J. d$ n% `& Z$ H         yDir = "down";3 b( c, G/ `8 f9 D# O
         }9 s& j  U0 L+ X2 n9 N
      }
, Q$ r! {' O8 Y0 Y: t' j: U% Q   if (xDir == "right") {9 S0 P3 G9 n! E* r0 \
      xPos = xPos + BallSpeed;6 I  ^7 [! T% z1 {
      }9 M5 c# h0 L( H& M/ e: D4 B0 ]
   else if (xDir == "left") {
# e1 |8 t1 s1 R; ~# j      xPos = xPos - BallSpeed;8 r/ w) A7 P/ Z( B0 n
      }
. ]. [# i2 v% I4 \' s! \" e+ n   else {* D4 A7 q* O3 ~+ O1 y
      xPos = xPos;# Y* ?: C3 e/ o& G! L) ^, ^5 h/ T: V
      }
' R. o+ }4 K) z   if (yDir == "down") {7 b5 C. t7 Q- ]% v' J
      yPos = yPos + BallSpeed;
$ }- C! ^4 h2 I3 R8 `+ {5 b      }. @) r' K- p; W/ [$ y# I
   else if (yDir == "up") {
/ R+ N- r( i: V& z6 K      yPos = yPos - BallSpeed;
( f) m, \2 l& b0 L1 ]      }
0 o/ M; p& j! K( |( y% O   else {
% b0 \' X. t$ R4 X' U2 z      yPos = yPos;! ?3 L0 |% Q& Y7 A- F; B- M
      }
3 ]% R& @# b5 z3 b, w   }
6 M6 X* ^; D# G" E; Q) H
( D. \9 v5 [; m6 M. v! }# [6 _function hidetext(){  h* j6 k: e1 w- O# _! f6 Z7 h5 N
if (document.all)( ^2 ?" f9 q) u0 A
supertext.style.visibility="hidden"" I# H) v1 h( J2 Y0 G  f
else if (document.layers)# l; H  t/ h/ d2 q# M/ y! m
document.supertext.visibility="hide"
# [3 F; s/ u+ ]: |( S! [clearTimeout(animatetext)7 L: d1 T! R5 s5 O0 i" ~
}
8 C) j# S" U1 n# A% Q8 Z5 P# A4 g, ^+ ?7 ~2 y6 P" F6 H
if (document.all||document.layers){; U# @6 Y0 m9 [9 c" n( Z; y1 t" E
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
5 ]0 u+ G: y8 N+ O" Rwindow.onload = initializeBall;
/ @) t# J4 G4 C  ^, Pwindow.onresize = new Function("window.location.reload()");
! x6 j- q3 G; ]5 ]  y3 w}! N6 {% D' K# e, V
6 y7 f8 s1 Z0 I8 Q2 ^' z& {9 w( S
</script>

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