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

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

<style type="text/css">' {2 [2 ^; Z: `, i
#supertext {
  }4 N. g2 I( T' [" Fposition:absolute;2 L+ [! m  J* r. }: p% f
left:0;
2 r/ h# i4 Z' l. {' @+ A6 Ttop:0;
7 [5 h$ B8 x9 `9 b+ Q+ [% avisibility:hide;) v4 b- r* d! ^) k0 J
visibility:hidden;
! |- V5 F. l; u! N}; Z: u* I/ a- E. t
</style>! i& d/ V( U1 ]  W3 U
<script language="JavaScript1.2">
' O; T) E  M) j8 m9 D/ a% q7 ^0 A<!-- 改变下的字体的大小。颜色-->
9 A5 n7 O/ P) O0 Q" Q. c, Yvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'- M1 Q; Z5 h( F5 e& B$ Z* l8 O1 y
var hidetimer='';3 y, t5 A$ R$ V, g
<!-- 改变下的弹跳速度-->0 h! u" F/ K7 y7 O* o: k. G
var BallSpeed = 20;
! I" J  d! D: b# j* I) q2 i* o; w8 c3 m! Svar contentWidth;
6 m7 h$ ^" R, k% yvar contentHeight;- c( d1 ?5 _3 h% E) \
var maxBallSpeed = 50;
, O; s5 v2 c1 E9 X- N, c# L% b+ o8 g2 z$ p! x
6 h5 o1 v: z3 b% d8 [# G2 {
var xMax;8 h# s( `' j9 Y; G
var yMax;
) R' V# T% {: B& Q# d9 v% Q" \var xPos = 0;
. Y% m6 Z8 X; [7 J  Lvar yPos = 0;) C+ D( z4 j3 c) u. g3 V9 c6 s
var xDir = 'right';
& k7 h- A4 @* b$ v; o9 cvar yDir = 'down';" |. }4 j! Y0 R' F; ^; F& u2 Y3 D* E
var superballRunning = true;
1 q+ t6 T8 W3 o4 A* A2 ovar tempBallSpeed;( w5 Z; W4 n- C( i
var currentBallSrc;3 y2 n/ _1 l' O' K+ x# D
var newXDir;
! W2 e+ f0 O  x0 {/ a! p. ivar newYDir;7 O# Q  y( p9 b$ v! o$ h' l6 M3 H6 ^

/ e4 G3 W7 H, I8 gfunction initializeBall() {1 t9 ~  ?: @1 K: z
   if (document.all) {
9 k, K7 }" Q+ \& l, B      xMax = document.body.clientWidth5 C5 {8 m8 s9 m  ]
      yMax = document.body.clientHeight  p) n2 \( v9 L( o+ y! e% w
      document.all("supertext").style.visibility = "visible";
- T" g0 o: m4 z4 q- R/ s      contentWidth=supertext.offsetWidth
3 N9 S/ R6 Z/ Z! C9 \0 I      contentHeight=supertext.offsetHeight: o+ G: M- `2 H2 A
      }6 `/ d$ P" I% X' J4 v$ P0 M* n
   else if (document.layers) {
$ U, l/ r1 [6 f" |0 o- W7 H      xMax = window.innerWidth;
* j% i- W* J% r9 w; ~4 D( d      yMax = window.innerHeight;
1 L' R, {5 F5 k- p      contentWidth=document.supertext.document.width
  ?! g  R6 h1 }      contentHeight=document.supertext.document.height3 S) z5 b. r( ?3 K5 m
      document.layers["supertext"].visibility = "show";
, N% K: l4 u! y      }
0 [0 A) l" [* k1 F- ]  P2 @   setTimeout('moveBall()',400);
* c% r- R3 H* ^+ D   if (hidetimer!='')
7 Z, q3 j/ H! n2 ], H' F5 c   setTimeout("hidetext()",hidetimer)
2 Q  [1 T. w' b: _   }
3 X/ a0 Q: Y( A8 g# d" F8 S  `, q" j* H
$ d: @& u1 r# _! p$ ^9 @  O3 Xfunction moveBall() {
3 Y7 ]. m5 j* S4 D   if (superballRunning == true) {
1 D6 {6 U3 o5 X8 Q% }      calculatePosition();
" L9 d# h0 X  y      if (document.all) {
5 N+ K, c: Y) n, @5 o4 I0 z9 {0 M         document.all("supertext").style.left = xPos + document.body.scrollLeft;
! l( S1 P5 [5 s5 B         document.all("supertext").style.top = yPos + document.body.scrollTop;; O, z0 N/ b' `0 @
         }0 r5 \) t* y- D7 H/ |, Q3 {
      else if (document.layers) {! S( L6 V) }1 \1 |7 n0 R+ x7 D
         document.layers["supertext"].left = xPos + pageXOffset;
* e" d+ |; s% S" c% I. |         document.layers["supertext"].top = yPos + pageYOffset;
) t+ l0 |* ~8 l& f         }
1 O4 s- ?$ H# u9 C& y; v      animatetext=setTimeout('moveBall()',20);
" r* Z8 P/ x4 L; ~  [      }) x5 N& n! U! b# S$ l  _% {! |
   }
% F9 y' r" }- w) U6 K6 C& n9 k4 b3 J5 M; V  [; V
function calculatePosition() {  ?, s3 Q& S) c# O" Q. r5 Y1 {; o
   if (xDir == "right") {5 w3 p; L/ W: f! F  n8 r; b
      if (xPos > (xMax - contentWidth - BallSpeed)) {5 ]; n- M7 M# u* o2 }) r$ w
         xDir = "left";
  k2 I* [5 A. y2 K$ J         }
; |+ n' E" _: Z7 `# e8 A      }
1 _$ H+ @  e& J+ ]" m4 E: c- I+ i4 I   else if (xDir == "left") {; h8 I1 N& }4 w0 r/ A
      if (xPos < (0 + BallSpeed)) {5 ?" K; k/ d- ]/ A2 Z
         xDir = "right";0 \2 l  Q1 k6 V6 W
         }
  |; s2 S4 \% p" k# ?/ i. N      }
( W3 h" B5 v5 z- n# U; ~   if (yDir == "down") {/ a1 J" s% X' ?0 z) q7 E
      if (yPos > (yMax - contentHeight - BallSpeed)) {
: M  r) S( d0 Q         yDir = "up";. e9 ]; l+ n2 ]; r+ J
         }" e' ]7 p% s) i5 g* j- i3 ~
      }5 u% x) s0 l; r1 X
   else if (yDir == "up") {
3 s9 N9 W9 `" B- `2 d6 j      if (yPos < (0 + BallSpeed)) {' V# @0 I# t+ C6 c* r
         yDir = "down";* @  [: [2 r6 }4 c3 r' l4 l
         }7 w$ I& F4 ^  z- l; x7 j! ~; ^
      }1 k- l* t5 v7 j
   if (xDir == "right") {
8 \) p+ l% }9 B6 ^& g" y      xPos = xPos + BallSpeed;5 H7 }2 O" }' i0 c! c  ?& v. }
      }" a' M" G4 Z/ h. Q
   else if (xDir == "left") {
6 G3 s  G. q4 M0 t* y% }      xPos = xPos - BallSpeed;( K1 \' h! [# `+ K
      }  G5 T( S! k3 d$ w1 D
   else {
9 P) E- B2 E) E) [  n" A      xPos = xPos;  Q: f% Q2 S+ V& @# Z0 r) @
      }
' k2 i* Q* f% h$ d   if (yDir == "down") {
4 W" q+ p& Q! x+ U/ ]0 ]0 z      yPos = yPos + BallSpeed;
' i  A! \& t' w2 }5 w/ b: U+ H      }  Q( f& @0 N5 t% ~, [6 A3 n8 m) [
   else if (yDir == "up") {
* Z- e% e. P3 S9 D, S! l$ C8 q9 ?      yPos = yPos - BallSpeed;  b+ l* L/ C+ u/ i' m' J
      }: ?7 x! W0 j6 i" o6 L9 I; p
   else {
) M$ C. j+ u$ t; ]9 I( A. m2 p      yPos = yPos;! Y5 O4 V2 o3 r9 ?
      }. L1 f* N' w; K% Q. g; c6 B+ B
   }1 ?, C5 d  j/ d, ]
# a3 }! z, M* r3 O
function hidetext(){  `5 z6 s, H# W3 Z3 x3 }* Z
if (document.all)$ S( k! R# q3 {% d5 a& d. g$ ]
supertext.style.visibility="hidden"
# D- `, x4 F3 `/ o" S1 ielse if (document.layers)( Z1 d; Z$ J0 i. k, w) ]
document.supertext.visibility="hide"
) D1 g+ A5 }: C0 G& tclearTimeout(animatetext)
( t: c4 K$ Q: [8 z# m  e. V* a9 H+ V}
& p7 B6 y" ]* q/ P# \0 z* z% K) [- u! A1 @
if (document.all||document.layers){
9 y% e" l% @# q2 T7 v2 wdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')- Z) O5 P5 K, M: J
window.onload = initializeBall;1 y* {; O1 I, a+ w/ Q7 _$ N% `3 J: C/ y
window.onresize = new Function("window.location.reload()");9 A. s0 u+ l" J" P; L
}
& k0 J; }5 k, S* r; G
; |/ i# U$ `( g0 L</script>

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