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

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

<style type="text/css">
0 p) {* A# ]* S9 j; v, F% V, C#supertext {
) Y) r  e" n% h/ Jposition:absolute;+ {& w" `2 F  \) }
left:0;2 l' n! N, z  D8 Q
top:0;
2 q8 S2 ~; B* X+ Bvisibility:hide;
6 u0 d* O, M- b( z5 H6 T* T7 evisibility:hidden;4 c# `: Y! G$ a& g  B
}
7 R' u$ [! i2 a$ @4 ~</style>
" K1 r1 N* r& |% @9 {7 [& _<script language="JavaScript1.2">. g+ F% B/ |. e/ p; u9 `
<!-- 改变下的字体的大小。颜色-->- ?4 D4 m: h) t" K& g% y! \8 g
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'# M  \! B  I4 {/ z' _- w: C1 x
var hidetimer='';1 Q$ `, p) x3 Z2 K
<!-- 改变下的弹跳速度-->
9 K- \' d: k! N- i7 \: H6 `  qvar BallSpeed = 20;
+ D5 `3 O0 V3 D& V( x* evar contentWidth;
4 ~0 _7 q) n  J6 f5 |/ _! Nvar contentHeight;
) A9 o' @# W# t( vvar maxBallSpeed = 50;
+ w! F4 c3 }, D2 z2 P4 y, d. o# I0 Z0 o1 R, Z/ [5 b
0 a) `3 p, \' ]  z! w: w
var xMax;% ]* o) H6 A% V" d; }
var yMax;7 i4 o( o5 I9 ^+ k& C& J% |
var xPos = 0;
, S0 O+ {) g( j! ]  {" N# mvar yPos = 0;
8 {) y4 g+ ^4 o1 Y7 a% [1 l9 Ivar xDir = 'right';8 N* N! {  @3 I+ i# P. b
var yDir = 'down';! C. l" R- ~. h. G* v+ Y7 X
var superballRunning = true;9 I/ ^4 Q" k6 N3 v' ]" N
var tempBallSpeed;
7 ]8 ^3 c/ G' K  Z: qvar currentBallSrc;: H. I3 j; L# \7 C
var newXDir;7 y( o2 J9 G- U' w! p- t0 p4 R
var newYDir;
4 H+ K$ f' d8 J8 v* Q& ^) y& |1 Z# m  e2 I. U6 h
function initializeBall() {
% ?) T, v3 L" U; G   if (document.all) {
3 X- M+ o  j7 E3 \      xMax = document.body.clientWidth8 a, I7 y+ `1 K! b  P3 h( r
      yMax = document.body.clientHeight
  V3 ~& Z. t" e' u! M      document.all("supertext").style.visibility = "visible";
8 B. ]- z9 e) l) I4 T      contentWidth=supertext.offsetWidth
- e. J9 F+ _9 a; i      contentHeight=supertext.offsetHeight5 A" U! N* ]+ n: {6 ^
      }
% T" K, k: P  t1 ?- h   else if (document.layers) {
0 P! M, \$ X% f9 ?- k, m0 q      xMax = window.innerWidth;" A6 ~$ ~+ x) S/ c3 l
      yMax = window.innerHeight;3 O4 ?4 `; v! h0 V
      contentWidth=document.supertext.document.width
$ ^" c# l2 L  S. O+ X" H      contentHeight=document.supertext.document.height7 h: T  o; d! x1 m. X% x" `
      document.layers["supertext"].visibility = "show";
0 I: l" t' L' [8 X" u' c6 T      }! T6 F9 c' M" k. [; V
   setTimeout('moveBall()',400);' C+ c! A5 j. u. t1 u0 I( Z3 B' K
   if (hidetimer!='')
1 ~, y6 y1 O- N9 \" @5 ]3 r7 K   setTimeout("hidetext()",hidetimer)2 C3 T* N; I4 D0 S, {1 c: W% U
   }
, Y; Q2 D- U  s* v0 x4 m; p/ F, w% d5 T$ S" C! c  s
function moveBall() {9 k& q( G" e& ^+ i* p8 K
   if (superballRunning == true) {7 J1 l% G/ d; a  ~5 L5 R
      calculatePosition();
; c1 @' g; D$ `$ R9 m, C* L; t% Q/ L      if (document.all) {0 ^2 W3 {$ Y& I' ^, X7 r; P
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
; Z. [* h7 f* R' H4 G8 c8 K. |' p+ r         document.all("supertext").style.top = yPos + document.body.scrollTop;' y: [  Y0 N) L+ ~4 w6 X  w
         }$ D7 n; \) n) h/ R
      else if (document.layers) {
2 @* ?; A. O0 t9 w: ]' s# [/ A         document.layers["supertext"].left = xPos + pageXOffset;
6 a# s* d' e3 d: P. m& x3 Y# G         document.layers["supertext"].top = yPos + pageYOffset;
) N4 r# X) v( e2 _) l1 f) W         }3 r+ h! _- {5 f, S- i2 D
      animatetext=setTimeout('moveBall()',20);
, @5 G5 G( T+ A6 ~: N2 m( Z      }4 Y! c; X3 A/ n6 }' a+ \! u! L8 g
   }" |% N; o5 h' l

3 R+ w! O, z  o. Ifunction calculatePosition() {& U8 F% G$ F2 P/ Y& [, e4 m! @  N+ q
   if (xDir == "right") {% l2 T/ h( l7 A8 y8 E
      if (xPos > (xMax - contentWidth - BallSpeed)) {
' e, ^7 ]+ m7 a" Z- U         xDir = "left";
5 n0 e/ W: w) G5 H* y4 {         }
; u# j& ~5 k0 k3 h+ N) J* k      }
4 J, J% Y# ?2 W' E   else if (xDir == "left") {
3 r1 B3 l; I- L# g; Y; V      if (xPos < (0 + BallSpeed)) {) b; S! d( y' N/ e
         xDir = "right";6 [& b' b' e8 G1 c$ c
         }
6 d- k5 R7 N0 ]+ `4 k& r      }8 |. p! `% j6 ^8 c2 h8 Q
   if (yDir == "down") {# }4 y( n2 G2 f' W, v* e" x2 g8 |* `
      if (yPos > (yMax - contentHeight - BallSpeed)) {
1 X" @" ^7 ^1 M% {# a         yDir = "up";
% P7 k- Z, M4 Y, I: J         }
( g! z$ D# r& C; d& g      }6 }( t: U8 G. Y8 X. Z; r
   else if (yDir == "up") {
- u2 h$ f0 j! G/ C  F      if (yPos < (0 + BallSpeed)) {' T) f- Q$ x0 T) c) G; Y: m4 E# m
         yDir = "down";
% {- L# [; I& t8 L  T% d8 X  u5 t         }
; Y* i8 {3 U  u/ L5 p* h      }8 U' F2 H) [2 T2 G: _2 l5 X6 v* P
   if (xDir == "right") {* |* {5 l  g6 S% ?- t  h7 E
      xPos = xPos + BallSpeed;
! u2 a8 ]% f1 O8 k      }
' H# {& F3 p7 O6 _) j) |' X   else if (xDir == "left") {5 E8 F( k$ k2 d+ q# |
      xPos = xPos - BallSpeed;) W1 ]* @9 H, @$ `( a% d2 F
      }
" w2 b! ~1 P# \9 U! H   else {4 n6 P$ y. s2 ~
      xPos = xPos;. G  W9 e& p: @4 ~6 U
      }
! D, s2 X$ m1 t, `' G9 p+ k   if (yDir == "down") {
& L  M, D* K) y' y6 L      yPos = yPos + BallSpeed;4 x, J1 C) W/ K# d0 [, _  Q+ ^
      }
' ?! a$ G6 Q0 s   else if (yDir == "up") {
( u  c5 e% I6 F4 d      yPos = yPos - BallSpeed;
( n6 R; l6 m3 ?- x& ?4 Z! W4 m5 D      }
/ ]0 A* K9 A& S5 s5 w5 G% p   else {
2 v7 K4 {1 H- S- X2 L, w) k( }      yPos = yPos;6 x/ H5 x3 a7 g- d+ C
      }) h6 G6 F) c" b3 j
   }  j5 {# y" D+ G1 e7 ?; p1 O

8 m$ c8 _/ ~; N6 L0 s2 n3 u* E9 `function hidetext(){
+ u/ z3 Y7 U0 D) [$ g- L  U' y! |: }8 m& Bif (document.all)5 ^, d9 T# R" k0 I8 O5 \/ {
supertext.style.visibility="hidden": ?$ ?! X# g8 G( A4 W3 h! r$ a  y, i
else if (document.layers)  [/ a% ^5 u6 t; K4 }* Z' l
document.supertext.visibility="hide"9 x% |# u! Q% \! B, @8 c8 h$ _7 F/ {
clearTimeout(animatetext)
7 _8 U6 i' x6 i/ v' H1 k+ s' D}, S2 A8 `7 @5 k& G" D
. A$ Y* S$ _6 _7 T" S+ F% A
if (document.all||document.layers){8 E" ]+ w9 s5 s# g
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')0 E" H" a% Y1 I. `3 [% X) _5 i
window.onload = initializeBall;- q8 Z- m5 L* `: c
window.onresize = new Function("window.location.reload()");
' |8 u6 b5 C8 ?/ e+ ?( M3 p}, D3 O2 R" X$ [4 q. \* ]% B- {

  i% _+ m& w% w6 e4 _</script>

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