返回列表 发帖

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

<style type="text/css">
6 Z2 R: K* T8 |/ P#supertext {
' X7 h! |; R- n! Z' Q- n5 A0 l! Z0 w6 pposition:absolute;9 l. b1 L# r! Y& T( a
left:0;
% j( r2 }; g  q2 u; F* o: vtop:0;/ D- j2 k0 r' S, |0 {& D) p
visibility:hide;) t4 K, J( T: r# C$ r3 E, |
visibility:hidden;
0 X6 u# _. j8 B4 j* q5 |}
6 w% G; r& m& V) ^+ D% v</style>" |2 r' ]: x7 {/ Q
<script language="JavaScript1.2">
, \: n, e. a$ w0 |<!-- 改变下的字体的大小。颜色-->) s4 `$ X( J* l$ p3 H
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
' D$ F% y3 P- wvar hidetimer='';
; n, a: H- {7 H( U, W. l<!-- 改变下的弹跳速度-->
) \; h8 h$ c4 x$ |2 H+ l: rvar BallSpeed = 20;
# z% `- h  @) A# k. u* C9 nvar contentWidth;, r/ ]& W2 n. w1 i
var contentHeight;
* r( d- ]# x: t' J# k0 Uvar maxBallSpeed = 50;
- B; L6 R' H$ n  O
0 T7 o1 t3 b7 ~$ Z  N1 T' r* _
! g# H2 r4 n3 Uvar xMax;' q" W+ n- I+ c/ A8 v0 Q9 e' h
var yMax;
# m9 C. _) k+ k; e% {! rvar xPos = 0;
/ Y. R  W9 }; E. w1 h$ Pvar yPos = 0;1 F9 Y# N, Q. M5 k  L
var xDir = 'right';
5 i5 N- |  Z7 Q/ u) E4 a! I  Dvar yDir = 'down';6 g: O0 [2 B) `, L5 R
var superballRunning = true;
+ c: M8 b2 X3 k" w; v8 t7 zvar tempBallSpeed;
& E" M' n% G8 w+ W' Uvar currentBallSrc;& E: J# H; X  j, k/ `7 @0 ?  }
var newXDir;
( U. @/ q2 J* S. Z% B& }$ s$ Wvar newYDir;
  ?% H( D8 c9 W) S+ L; v
+ q" J0 d9 d* p8 qfunction initializeBall() {9 T" Y9 ?# y. Q3 h4 ]
   if (document.all) {
/ d( R3 Y3 T6 P2 G# Q( [3 [# s+ h      xMax = document.body.clientWidth, ]' i7 s4 O; `6 C7 J
      yMax = document.body.clientHeight
! _5 j& _% [$ e, `# }  u# J      document.all("supertext").style.visibility = "visible";
* M8 L' H" E4 x5 v, k% P      contentWidth=supertext.offsetWidth
' Y6 W2 C6 Q" [+ i2 \      contentHeight=supertext.offsetHeight* \5 a& ?/ C5 B
      }8 o4 B" D$ J% K' v
   else if (document.layers) {) n' ?7 s9 n% K; |/ g
      xMax = window.innerWidth;4 a" z3 _% Z6 B5 b0 B. c/ k. n
      yMax = window.innerHeight;+ I, y: f8 u2 _3 g4 `
      contentWidth=document.supertext.document.width
+ m& F- r  M0 H# D& O      contentHeight=document.supertext.document.height7 _; [7 e( ?! @7 K5 d6 {
      document.layers["supertext"].visibility = "show";" [, l3 ^( g2 _+ {
      }) [4 D8 T- o# q# M6 }6 {, v1 ~* z
   setTimeout('moveBall()',400);( y; w# {7 b2 D) K+ V
   if (hidetimer!='')- {( s% l) a& n, p4 e3 O* j' X% G
   setTimeout("hidetext()",hidetimer)
( o" d/ b7 \8 _5 D* y   }6 }' g1 H' l, f3 b3 Q7 |
! G, B) H" h: o( n7 e
function moveBall() {
# p8 {1 ~( r. W2 c. L+ _* X/ R# H   if (superballRunning == true) {, U: F+ \% j# Z" e
      calculatePosition();
% `& z- E, j0 S# E8 M      if (document.all) {, R" Y, x: [1 c+ U- u; p' d
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
: R) J5 ]% g! C6 g& I* J         document.all("supertext").style.top = yPos + document.body.scrollTop;
: J8 e' Z4 H$ L# T+ [7 R         }
6 o3 q; l9 j% k# [! j      else if (document.layers) {
4 F* h" b8 x8 C, a# K9 [% {         document.layers["supertext"].left = xPos + pageXOffset;) n/ z; c& |, m! f" Y* O
         document.layers["supertext"].top = yPos + pageYOffset;
* `; u! W& V2 g3 C         }6 _) ?6 Y' a8 `6 o1 m
      animatetext=setTimeout('moveBall()',20);
! e! g% s: U# ^      }
& a0 I" S' H9 W# S0 s% e% I% o6 G   }; m, v  i: D6 I6 G( Y8 E7 D! s

  @/ V/ ?4 X9 \1 a- M' Ifunction calculatePosition() {( x+ u8 L6 w9 h- v
   if (xDir == "right") {
( O& o) q4 d$ p3 R* h9 h- z5 F      if (xPos > (xMax - contentWidth - BallSpeed)) {; V  E3 K2 Z8 r9 b1 t1 @) g& F% g
         xDir = "left";* V7 c) C0 z3 C  Q
         }
6 i& F$ ?2 K3 X6 ~& e      }. J- J- q. p$ G- R  r
   else if (xDir == "left") {5 j  L1 O: ]+ z8 d% g2 W0 q
      if (xPos < (0 + BallSpeed)) {6 ?' |% S( U: I; @: Z! _( r
         xDir = "right";
- D" Y# G! p5 h  C/ Z& l- u         }
9 u# M) X5 j" y$ }      }1 s1 ?# f2 a. M2 n3 r
   if (yDir == "down") {, a4 V5 P/ V( @
      if (yPos > (yMax - contentHeight - BallSpeed)) {
# R2 \+ N+ z& [# Q3 B( R         yDir = "up";0 J& y- b) l' P" L# q
         }+ f4 J& h1 o5 Z0 ?# h& ]
      }
! X& [- w  L% F5 r7 ~8 g   else if (yDir == "up") {2 |! a! b+ f* G1 a0 D0 ~: n" ~0 I  w
      if (yPos < (0 + BallSpeed)) {
& G/ W7 ^0 [- d! j6 ?         yDir = "down";
2 \: e4 k9 F, V$ n3 P1 P+ w  e1 f4 |& J, ~( |         }
. E, H0 N* [( L! ]      }) K1 q6 M* b8 u0 u9 [5 x
   if (xDir == "right") {$ k  o% h( }, b8 O
      xPos = xPos + BallSpeed;
0 z0 n; P6 Q. ?& G      }
& {) V% _+ E2 @2 K8 X   else if (xDir == "left") {
$ j1 L* o8 y5 u3 g      xPos = xPos - BallSpeed;9 W" Z8 \7 E1 y, m+ _
      }
. T( l# A. E+ M3 ~/ y; a2 L1 T# j   else {: \6 p: a# |# q- L' L1 C% g
      xPos = xPos;
: P# {) F) X/ J3 k/ B0 s0 K7 h      }
; x  Q$ Q' h% A- W   if (yDir == "down") {  i" a+ P0 h; P2 l3 I& A
      yPos = yPos + BallSpeed;0 ]9 N" C! v/ f& S9 s) ^
      }1 f/ b7 `8 ?0 ]* h
   else if (yDir == "up") {
' }2 z5 V# P2 b9 x3 W8 W. F      yPos = yPos - BallSpeed;: ~6 S3 l  Q: r$ V
      }. _2 C  M0 T: \/ ?
   else {2 C5 U+ L. Y4 f# X* Z
      yPos = yPos;
' l4 z  I) R. E) l9 {8 c! D      }2 F4 d, U" O8 `4 d9 ^' U! \. `6 h% e
   }
) l) C6 z1 v% d7 ~' s. |
' ^1 S9 u" |7 s: Y' u  k; o- l5 y( bfunction hidetext(){
; D+ u- m, g+ ~6 D9 S* Gif (document.all)2 h: L' t' r1 ~
supertext.style.visibility="hidden"6 r  L! u/ c' ?% [' W5 Y' t' K
else if (document.layers)/ Z6 _3 J% ~/ ?! n
document.supertext.visibility="hide"! A$ C* d- d5 u- M# E8 L- ?
clearTimeout(animatetext)
1 M$ w/ y% Q7 U( p2 H* d}( h% m) [- n9 C" I" L# d3 Y0 [
7 L& \8 ?5 t, G
if (document.all||document.layers){
1 ~3 W2 y4 p  e) |( o* K% }document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
; u% z# u5 B- D5 Kwindow.onload = initializeBall;5 v5 j+ j4 C3 P0 L! u
window.onresize = new Function("window.location.reload()");
$ d  H4 L- M* y) ?  ^+ X}
9 \9 x$ |( H: [' I* M* r( o8 M) X; x  e( h# w$ a! K: [9 X) G1 q
</script>

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