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

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

<style type="text/css">
$ p0 b0 J$ t& \" N$ y* H- l, W/ ?: k#supertext {/ \# Z; D4 f7 i6 t2 Z7 z
position:absolute;; Y4 ^+ ]; F; m+ J# T, a
left:0;
8 a) L3 a( `; k+ s7 k& \" Itop:0;# G, k, W: T. S# T$ r3 X
visibility:hide;8 {1 I+ K6 W  o( |% J' ~. c" w: E- g# a8 [% q
visibility:hidden;7 H1 Y6 a0 |- q* C" ?
}
" R# \1 c+ E! y. L9 |: r  R! X" U</style>
2 u; Y% I5 u: _0 W# ^2 G<script language="JavaScript1.2">9 n  R! Y' n+ F0 L% P* M
<!-- 改变下的字体的大小。颜色-->
8 l* X; y0 W& rvar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'# _% j# ^3 ^1 X. m( U; A
var hidetimer='';
! k3 g' K+ f7 r6 ]<!-- 改变下的弹跳速度-->
: L. h1 |4 X. T1 Pvar BallSpeed = 20;0 B8 R, w" l- y" v8 H" M
var contentWidth;
& A9 x8 C6 k5 L% n* o' zvar contentHeight;
5 I0 p; C# A8 c0 h6 L% Lvar maxBallSpeed = 50;( J" v8 b# D. Y; r& V3 p  m

( b0 Y- ^- x1 a( b8 d3 Z
2 F8 l% d( }" [: p5 \% a9 V# ^% b0 Xvar xMax;
; i5 V' i3 }8 f$ zvar yMax;* ~% @, A$ s9 l; N0 X, w% n$ M; N
var xPos = 0;
& S# L4 i4 \1 G: D4 |var yPos = 0;
" Z9 Z: |0 i: D& s. dvar xDir = 'right';7 T$ C9 A1 |" d$ o; \7 Z& T( B. ~
var yDir = 'down';4 N: C; E: j0 \. H; m
var superballRunning = true;
  ?, Y; l6 y9 W$ [* s# jvar tempBallSpeed;' Y7 t  a: b7 ~( j! s% t3 S5 H1 Y
var currentBallSrc;
# n; k$ w. `% Rvar newXDir;
2 k- E# r1 g7 i" G! Ovar newYDir;
( L4 C5 A; W9 n$ G6 z3 {6 R! {" [1 U0 v: c
function initializeBall() {
1 N/ u1 q) {3 ]2 c' O& ^   if (document.all) {& m0 |; @# f+ R
      xMax = document.body.clientWidth
" D1 x0 m# \2 n+ F      yMax = document.body.clientHeight
7 z' @. n8 ?& R( g2 l      document.all("supertext").style.visibility = "visible";
' C/ [- k' \8 Q' a  |. y+ D      contentWidth=supertext.offsetWidth1 I$ C% x6 @/ X  h- R
      contentHeight=supertext.offsetHeight
- s$ a# L6 V( z( I8 u) L      }
; G1 S$ f& ^5 }7 I  F   else if (document.layers) {
0 T/ u# A+ _: v# U9 ~' Y" Z      xMax = window.innerWidth;
( z  t/ Y/ p7 v, f, j( c, s# b: y      yMax = window.innerHeight;+ f, i6 k& K) U9 W9 ~; A
      contentWidth=document.supertext.document.width
/ O% c! H6 @6 [; U. L, U      contentHeight=document.supertext.document.height- T0 D, q/ K, Q8 C* z' s9 i% N
      document.layers["supertext"].visibility = "show";
# v0 b' F9 R. h7 X9 [      }
# e# |! H# i2 q   setTimeout('moveBall()',400);- c6 a* M1 @4 Y' z, L, f
   if (hidetimer!='')$ G( m  N, i+ Y2 d& ^' u* Y5 e
   setTimeout("hidetext()",hidetimer)
5 A/ j: T# S# g2 Z# o/ O2 J! F   }9 M! l' S! W3 o' Y

" S" S8 W4 U9 n0 j4 g' g1 X: Ofunction moveBall() {2 p9 u, G. A( |& [/ \
   if (superballRunning == true) {
- U- H6 i/ ^( U7 x: `+ c      calculatePosition();1 y5 ]: ~8 Z* R7 c4 Y/ t
      if (document.all) {
' n% o3 d# ?3 R, G5 n5 C         document.all("supertext").style.left = xPos + document.body.scrollLeft;) h2 y: K: s; U8 t
         document.all("supertext").style.top = yPos + document.body.scrollTop;
/ Q+ k* f$ Z( {" L1 w" b$ X         }
% s3 G) D( O9 i) x1 N; _: s      else if (document.layers) {  b1 `* s) J! C- K
         document.layers["supertext"].left = xPos + pageXOffset;
) v7 U; L4 N# B) g3 |& G  b7 `# L         document.layers["supertext"].top = yPos + pageYOffset;1 ?! F6 U/ ~! J' P8 w. N2 b" T
         }  V. q$ t. R! W8 {8 t/ c
      animatetext=setTimeout('moveBall()',20);
8 o  ]' j% Z. ^      }" |' i$ B9 d# l. X) y, H: W
   }: k; {2 `# |; v; G7 f. E
9 [6 d3 T, H. w& h, n' m
function calculatePosition() {
" Y/ S' ?  ?+ }" ~% c* K   if (xDir == "right") {
0 n9 `# X* M" v) ?8 s. T      if (xPos > (xMax - contentWidth - BallSpeed)) {
% ?$ d! _: J' E9 V) `( r         xDir = "left";! j/ A3 A  r  u% r
         }/ d6 R4 F: ?9 V2 G" \
      }
8 w( j2 y+ `# P2 T   else if (xDir == "left") {$ G0 u' A, P/ A- @
      if (xPos < (0 + BallSpeed)) {
, a$ F3 |6 i- r4 G3 ^. f$ ?0 m) e         xDir = "right";4 ~1 k& _! W6 ^7 J7 M
         }9 ~$ x% X4 ~0 {; M& z. z+ Y8 Z
      }) ~+ i* h5 B& e, C$ E8 S6 x; R
   if (yDir == "down") {4 l1 r- q! m+ ]
      if (yPos > (yMax - contentHeight - BallSpeed)) {
' L3 Z7 t5 k. d! Y/ r; j         yDir = "up";
' d$ c- W* J4 c. D3 j+ v         }
- t( R8 k" y8 a# u, z& Z3 r* O      }$ d6 q, M/ |4 }% c
   else if (yDir == "up") {( P; P3 S# o* k0 [1 O
      if (yPos < (0 + BallSpeed)) {2 V( u1 E0 b& g
         yDir = "down";* o4 u9 U# ~9 g: t+ E
         }
3 n- ]- k0 ~7 @# N; a, F  r# W      }
- s0 w& W) }( g   if (xDir == "right") {$ o+ P+ M6 z; }6 ^) g
      xPos = xPos + BallSpeed;
* m; g9 e+ \. H0 z8 \+ \      }6 T/ V* C  \; w- C8 Z  Y
   else if (xDir == "left") {: [& @6 T0 [% m8 ]/ O
      xPos = xPos - BallSpeed;
0 Y9 r2 `% |7 D7 K: z. [      }
4 v& E) R" q' w7 b, \( W' c. u   else {
5 \3 C2 s1 I* O# z      xPos = xPos;
. j0 H5 b5 ]2 N      }
( z+ f/ g3 G$ A" n9 d   if (yDir == "down") {( h: u3 v! ]6 |( E! c1 t4 ~4 G
      yPos = yPos + BallSpeed;- F8 c& b, M+ {0 ~
      }
7 E- r! r# o2 Q1 Y' G   else if (yDir == "up") {  D- r# N: q/ e, g0 R- u6 ^
      yPos = yPos - BallSpeed;$ s5 a* I8 Z+ ]8 h8 h" Q
      }5 q# P' x% _2 E  N1 f% X4 V
   else {3 a, Z  e, K' s" D6 S% B6 P" V
      yPos = yPos;. x3 h. N) R  W% @' ?
      }
5 q  p" ]6 z# b0 X1 {   }; s8 @0 L' h3 ~4 n0 O; t
7 x: p( ?" O# Q4 g3 X
function hidetext(){
2 N7 E+ K1 ]9 ?+ sif (document.all)
  e+ ~' |$ R7 Nsupertext.style.visibility="hidden"
6 ]* v+ E+ G' z, _8 V0 H. q' M- N2 pelse if (document.layers)
; Q  w5 H/ F+ G9 I; Gdocument.supertext.visibility="hide"
2 V* d- v; w. _) D2 c1 [2 \3 V. TclearTimeout(animatetext), M- _: I5 q! \1 y
}
& Z' j* H. \) F6 A) i' w# K7 j: ]- k) t4 H: k
if (document.all||document.layers){/ b# b' B- ]0 {0 [- r
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
; Z$ y: ~5 e8 ^' {window.onload = initializeBall;
6 z2 M- N9 ~+ s$ j1 M4 |6 X7 cwindow.onresize = new Function("window.location.reload()");0 H7 l5 X' _$ Y2 d. \4 Y
}5 Q1 O: U8 e% w5 r- Q5 \4 e& w6 }

: G# i& L4 u2 v% L2 g5 F- n7 O( Z</script>

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