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

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

<style type="text/css">
( ~" a7 T* m" P9 W) L  }#supertext {* ]8 q, T  L/ t6 C! I
position:absolute;1 M+ B, X, S4 }1 X, }3 u
left:0;
% `7 h- g8 Y9 m/ ftop:0;
; O5 M% r6 ~1 S. O5 pvisibility:hide;' d( {" z/ X4 H, V& S4 f& A: h
visibility:hidden;
% q4 @+ c- Z1 f  L}
: X! R/ C. W' R7 @</style>
1 w. B4 I; N) v! Z6 }<script language="JavaScript1.2">
- _: {  x0 }! b" I( ^; K<!-- 改变下的字体的大小。颜色-->
* Q2 g: G$ F0 u# B3 Y( e% |var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
$ b4 {: f* f( H8 j3 W5 gvar hidetimer='';
7 o" l$ C9 ?# i# q' ]; z  ?1 Z<!-- 改变下的弹跳速度-->
$ i3 r. R% b+ C$ avar BallSpeed = 20;
! _! Z6 n$ H" evar contentWidth;
9 _: e" J0 i9 Y6 q% wvar contentHeight;2 e+ U# l7 x; Y* P* F4 }% l
var maxBallSpeed = 50;
/ n  j" O# `/ h1 W8 T) X+ v
( M6 J4 h0 ]+ H8 v8 f6 s, I1 y2 e  `7 j6 M; J5 ]& e
var xMax;
* w& J3 m: r# a8 B+ u/ u8 [var yMax;
0 d! ^, I" W# t) n* p( p. |; mvar xPos = 0;
+ s9 P: U  X! @6 G, U# nvar yPos = 0;1 j% D' f$ @/ U: A; G$ U
var xDir = 'right';6 u' _2 b. \& T1 J# ^  h& I
var yDir = 'down';3 |+ c1 C& W  A1 ]" v9 N" S; J
var superballRunning = true;
( l" ^: {4 L- e/ u0 M1 avar tempBallSpeed;: c* c! d( Z& [& s1 o
var currentBallSrc;
" J' c" B3 k: bvar newXDir;
) L, b/ P7 ~( m7 m4 O3 n+ |$ `var newYDir;
8 n7 ?1 l) R1 D( A/ C2 h+ [, N  I* f9 H" U
function initializeBall() {
: ~2 f4 @7 r0 r9 `* U7 S   if (document.all) {
( P% Y  `+ k7 {2 B' m8 G      xMax = document.body.clientWidth
2 I6 A3 q- W; t5 \, S- }6 Q. j: Y9 L      yMax = document.body.clientHeight7 L7 X% d" @  V0 l
      document.all("supertext").style.visibility = "visible";
1 G; i5 c2 `, `& A/ F& }& R) e8 C      contentWidth=supertext.offsetWidth" _8 s4 Y2 @2 G  r% E
      contentHeight=supertext.offsetHeight7 n" Z4 v4 q8 N1 w9 T, ]2 l# V
      }
) w; k4 G/ B( e3 D   else if (document.layers) {( D' [' F5 k6 V! G" x( @+ B
      xMax = window.innerWidth;+ }, T. Z" V2 r0 j1 N4 C
      yMax = window.innerHeight;5 @' @9 z5 }* C3 t
      contentWidth=document.supertext.document.width- `+ w) E" ?  C" J+ U# o
      contentHeight=document.supertext.document.height
3 a; O+ m% ~4 U0 H6 e( O' j! f/ p      document.layers["supertext"].visibility = "show";. b, \) W' ~) ~7 B+ X
      }$ W9 p# g" T5 B) B* h+ @3 d
   setTimeout('moveBall()',400);
9 a' C2 _8 Z& U& D% K6 o9 m   if (hidetimer!='')
. `  V8 D. ^+ S5 {5 n   setTimeout("hidetext()",hidetimer)8 ^$ a  u( [% y4 }. U9 k8 c! j' X
   }& Y* f1 {6 c+ N4 ]% q- W

; V' v" I' B6 j/ |3 j6 Cfunction moveBall() {
2 R8 }$ Y" u6 G& I2 {, o# M& ^: {& O   if (superballRunning == true) {6 A1 i" F, G0 w. w5 J' U
      calculatePosition();
9 @2 E  h$ h$ Y$ A. h      if (document.all) {+ s" m/ s8 A9 H/ w+ P- J2 a  Y& r/ h
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
( v( H* b/ v7 {1 f; S' ?  S9 _9 E: p2 L2 n         document.all("supertext").style.top = yPos + document.body.scrollTop;, g* _$ R/ J1 ^5 }3 ^
         }& r: X) o4 N  T: n9 W
      else if (document.layers) {' t( \4 Q. v# S4 V
         document.layers["supertext"].left = xPos + pageXOffset;
. m% X: U% M# m: R         document.layers["supertext"].top = yPos + pageYOffset;
/ I4 `8 F' V3 p  G         }
( Q1 H7 s5 o" }* x* D4 e      animatetext=setTimeout('moveBall()',20);
8 I$ J( b" `: ?- X4 Y      }
! a/ y6 B3 r: r# S; W" ^" M   }2 R3 Y- D+ Z" ]) E3 k) P

) M  l; r) C9 r5 r' b2 H0 _- zfunction calculatePosition() {
8 V- X& d' p4 l# u   if (xDir == "right") {3 H4 i$ b  \3 G; z) ]. q* A, F
      if (xPos > (xMax - contentWidth - BallSpeed)) {3 y& ~) b7 r! w' O
         xDir = "left";' Z. T- C2 }$ j; K4 \
         }7 {# J$ i1 t! X8 n9 F( D
      }
; T+ d' t9 Z! @: l1 j: T   else if (xDir == "left") {
" \: N% W( S( x1 s      if (xPos < (0 + BallSpeed)) {7 }' O6 c- E7 x
         xDir = "right";
5 ?# S+ F1 |& a0 L$ }: q8 F         }9 g5 M" l& Y6 u
      }8 _) S+ v1 p* W8 j
   if (yDir == "down") {
' ^% Z" F! F3 U1 c' d$ H      if (yPos > (yMax - contentHeight - BallSpeed)) {9 v( e+ @- O. R; c- j
         yDir = "up";7 i. m% K5 ^% w8 K2 `) G
         }5 B7 w7 e6 j  h+ F3 e- B$ O
      }
: v' I/ Z% L% d7 d3 u5 E# o0 r& u( p   else if (yDir == "up") {
$ R6 }2 }! [3 ^& P& p) u      if (yPos < (0 + BallSpeed)) {# a5 `& U* c5 E; x
         yDir = "down";$ n0 P% z/ M- I; o# S$ P
         }
1 j4 {7 ]  M  }( _      }+ Z& ^  I! _: D' y
   if (xDir == "right") {
3 D7 [  K5 f& k! j6 x: V      xPos = xPos + BallSpeed;" C+ u8 B8 A$ P3 b. w* S) ~9 q
      }" w( V* [2 M8 ]7 Y% z
   else if (xDir == "left") {
- H' p# c& j/ Z      xPos = xPos - BallSpeed;' a9 w" u; R( ~  ?" w9 g
      }1 \& E8 R! X$ k- ^
   else {9 S! a& c+ s7 H0 C8 J  N# \
      xPos = xPos;& r( c4 `5 i8 J0 @! N! T+ i$ k
      }, J" q% R! k5 I+ ^! c
   if (yDir == "down") {
; m7 o9 A, P8 M/ y      yPos = yPos + BallSpeed;9 R1 N# c& v& @
      }$ j" Q! k) u: x+ v8 C* g1 c
   else if (yDir == "up") {1 @; O* ?5 \1 [$ ^
      yPos = yPos - BallSpeed;
6 E' v0 C1 G' y$ i# N      }0 y+ j4 W: k( X$ o
   else {2 t2 j( \* ]2 s4 H4 v) M& \/ h( U
      yPos = yPos;+ s4 A" z( x! X) C  J
      }
3 m2 O9 c% w+ F7 S1 u- v   }
6 J1 t7 L) }  i* N% M! o; F8 D( S7 f- g& i; P) j  d$ \; H
function hidetext(){, ~1 ~, B# m; I: z$ U5 [
if (document.all)/ G( E) [$ \3 M8 h
supertext.style.visibility="hidden"
- s: |4 n; Q1 t/ p/ ^1 r* @else if (document.layers)7 ]. t8 P" `* X; `
document.supertext.visibility="hide"2 f  S! I4 P. u
clearTimeout(animatetext)4 B% i6 {. `4 x# j3 m# h1 r
}' \9 g* p5 c0 J

& Q! ~+ i: I$ T! `6 K, j7 p" t1 s" U) Qif (document.all||document.layers){
/ N- _( o* e3 udocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
0 v9 D# l5 q8 X$ B, i5 X% c1 H3 swindow.onload = initializeBall;( P; P- s. i+ h" \2 O6 S
window.onresize = new Function("window.location.reload()");: h) l. V8 f% Z2 D
}
0 S7 \6 Q+ c' w: r6 U" Q; }# [7 m% g& S5 `- U0 c2 d, V
</script>

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