返回列表 发帖

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

<style type="text/css">: R5 v- A8 t9 B: @
#supertext {4 r2 L! Q( G# t/ c
position:absolute;
1 _/ e3 U% h/ W+ N) f) G2 M1 t# Uleft:0;. c6 A/ p; u5 O/ {; [+ ?1 k
top:0;
3 U1 G% _" D6 z+ M& gvisibility:hide;
5 j% C. O9 w7 j  Cvisibility:hidden;# J2 G1 X4 u, e( I6 |
}- p5 o. ]* @6 m8 x, Y8 e2 b
</style>
0 D  [6 R* R8 |" F! B" ?5 I<script language="JavaScript1.2">5 b9 C2 p- }" y
<!-- 改变下的字体的大小。颜色-->
+ H  d9 Y- {5 ^: X; Z  Evar thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
- X, c& X" T3 g5 [9 N0 Jvar hidetimer='';
/ A4 g2 h" C" o9 A1 {5 M: Y: n<!-- 改变下的弹跳速度-->- r: |7 S3 ?1 N: o
var BallSpeed = 20;
) |; K: h9 V; w7 o) qvar contentWidth;( \- S9 q/ {' R# w3 g. R
var contentHeight;" g; a# m) H( ]% g
var maxBallSpeed = 50;
% l6 M! O7 Q3 T# ~$ K- Q! i9 b' Z
  Y+ F; {* s! r: ?8 B# J* J- P4 N! M5 |- [6 R9 l6 Z" n
var xMax;2 d5 P1 {: t/ ]( A
var yMax;9 [5 y+ j& d& e- g" R( V
var xPos = 0;
" i# n7 S6 q+ T7 e$ s2 P, I" j6 T% evar yPos = 0;, e% u# ]& p0 j+ Y; X
var xDir = 'right';0 S  @# L7 G# N* L% ^) x2 j1 G7 u
var yDir = 'down';9 ?; H/ S" S7 D1 k3 F  J
var superballRunning = true;! Q& F3 r4 i! `! u
var tempBallSpeed;
2 c! h1 }. |. g& h, a/ @var currentBallSrc;
3 p( u0 Z  H4 c2 @- l3 bvar newXDir;
% c& E( X1 ^2 Y+ b8 Z& s) @- K, m0 Zvar newYDir;
5 v3 V- a. t6 h) k' p# U- a0 x+ ^$ w+ I' p1 X) [- p! @1 c7 b5 o
function initializeBall() {
8 k1 ~: q  h  [   if (document.all) {
6 U' e( Q5 j0 b" \5 @2 P3 q' s* o- {      xMax = document.body.clientWidth* |0 U- q9 H2 a- S- `
      yMax = document.body.clientHeight8 v% ~1 W# [! f. s9 l7 Z
      document.all("supertext").style.visibility = "visible";! }; v5 Z4 L8 K
      contentWidth=supertext.offsetWidth: `' @- K* U' q4 a( L4 E
      contentHeight=supertext.offsetHeight
# ^  @. W5 @0 q/ Z      }) c+ E) U. {0 s5 g' a+ p6 n
   else if (document.layers) {
; E1 p# d3 A5 s7 K      xMax = window.innerWidth;
4 n4 `3 r6 Z7 z1 r2 x; K1 K      yMax = window.innerHeight;! T" K& e* @- ~+ |" ?7 u
      contentWidth=document.supertext.document.width
5 z4 N$ D" \- Q* _. ?  v      contentHeight=document.supertext.document.height8 F! Y( y/ E) E7 `, }' ]
      document.layers["supertext"].visibility = "show";( K3 j# Q% E) e4 ^( g1 j
      }% L- G2 k  ^3 v* w% w! `6 L2 w
   setTimeout('moveBall()',400);
3 q4 c3 Q6 X' p7 x   if (hidetimer!='')
+ f" e: Q3 P7 J9 y   setTimeout("hidetext()",hidetimer)( w+ z7 H# u. |4 O! ]
   }
% F+ G$ g9 R6 k+ v, }2 j
1 }# |. I0 _/ Wfunction moveBall() {
& z" y( p4 b: N2 Y6 b% p  L   if (superballRunning == true) {
7 }3 v3 r* k1 h  v# B5 n2 I8 t      calculatePosition();4 B3 [  L# j% I. R" d8 H$ D. W. c
      if (document.all) {* B' P/ v4 l' R+ l$ v( Q+ p2 S
         document.all("supertext").style.left = xPos + document.body.scrollLeft;% b( v7 `* m6 |# A0 S1 q! N0 x9 e
         document.all("supertext").style.top = yPos + document.body.scrollTop;
" W- G1 P1 ]# r( u         }
0 [( j$ C3 P  _/ h0 \' L      else if (document.layers) {
0 w% U9 s! ]2 Z) `! R" v. I         document.layers["supertext"].left = xPos + pageXOffset;
2 h7 N; W0 }2 m; d" E0 Q9 y         document.layers["supertext"].top = yPos + pageYOffset;0 T1 f& T$ b' y' j9 ^& _$ O
         }
% }: W# A1 ?9 w" d: R; U! u4 I      animatetext=setTimeout('moveBall()',20);
4 t- p7 d- n$ D* |% n/ \  D      }
. r) `: e: ^5 x5 _   }9 u' L3 b1 ?0 m4 P9 l0 D- V) b
/ C+ u9 a/ Z% u- B, ^9 H
function calculatePosition() {: P  I7 }7 p% j4 c
   if (xDir == "right") {
2 k8 }1 h% Z2 R+ t; z" Y$ h8 y3 @      if (xPos > (xMax - contentWidth - BallSpeed)) {
4 I: ?' O/ K  q5 W- |( p$ w- f         xDir = "left";
/ I/ H+ |- F+ j9 r: R+ J         }
- i2 K% d* J2 n. ?  R( a+ k3 j6 Q# l      }
; B# O. N+ V9 P$ N5 d. s" N4 P   else if (xDir == "left") {2 V5 A3 o/ m9 `* ]9 _, v
      if (xPos < (0 + BallSpeed)) {
1 e: O5 a9 i+ {, B- Y         xDir = "right";0 O* ~" _, }& ~8 C$ h* n# K
         }
  b8 i6 \$ ]+ O      }+ m& I7 [# s+ w* y
   if (yDir == "down") {
- t9 _# w" ^% H7 D  m      if (yPos > (yMax - contentHeight - BallSpeed)) {! r8 }4 a" s, M1 D1 p
         yDir = "up";
! [1 T8 c, ^# a! L% Q' [" `2 Y         }
8 e$ l/ `8 Z6 |0 y$ r- e5 x      }
" f: D' c8 i& h2 k( {   else if (yDir == "up") {0 S/ i" ]! ^9 E7 e5 Y, O
      if (yPos < (0 + BallSpeed)) {* a4 j7 o) Z4 `) d& l; f3 h9 p
         yDir = "down";/ k3 p3 W" A- k1 h3 {
         }
9 X" _8 g/ N3 e; f4 m      }6 ?+ z$ D: K8 J! R
   if (xDir == "right") {3 h- Y6 v  W. u/ w# P- n$ n. X3 R
      xPos = xPos + BallSpeed;, d7 r: r" h3 C" l7 B; F3 c
      }& u; `. Z! k% y
   else if (xDir == "left") {
* `  B3 z5 u/ t; |7 V3 U      xPos = xPos - BallSpeed;
5 C$ p6 e8 l1 W) o      }
+ O; F6 a& D3 d% L   else {- y+ P& Y7 \5 t
      xPos = xPos;
; l& L4 P7 k1 R# \1 I3 A2 J' |      }0 y+ y; r' x' ]0 B1 `  s
   if (yDir == "down") {; p7 s7 O1 z5 X# F* K/ J0 |* q
      yPos = yPos + BallSpeed;! D. l, o) U" \: U) m4 s& q: _
      }- h2 r" X  K2 s' u
   else if (yDir == "up") {& [( Q" }: \2 b8 P1 Z
      yPos = yPos - BallSpeed;
7 E7 L: d  m0 Z, ?      }
- b: z3 n% }# C9 I0 x. Y$ }$ F- U   else {( B* B( ^8 v3 m( q8 |2 a9 P
      yPos = yPos;  f5 `- I' F) O* }' Y+ |1 V7 h
      }
% w6 e( p6 I: k1 W* v   }# P4 {* d4 e3 q( L0 T/ p
3 @0 b; _, z7 [8 k3 o3 I8 _
function hidetext(){
) o; e' q) Z; B4 v# M/ iif (document.all)
' U& t0 ~- F! X7 A4 \; {0 S+ Nsupertext.style.visibility="hidden"
  K( f6 o2 j2 @! Z, telse if (document.layers)
* m8 w! C# T7 A+ D) Ydocument.supertext.visibility="hide"' v: ~$ `; b5 {
clearTimeout(animatetext)- e+ }/ ?! k$ N6 W3 |
}; a5 w* y: A$ ~; v4 F7 p
& @3 G: C$ Y. }; X  Y6 z
if (document.all||document.layers){! J4 x+ s7 U( x( b. M- m
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
8 U& e+ N" f6 Xwindow.onload = initializeBall;9 }. h  s! q3 g2 L4 }* n, Y- B
window.onresize = new Function("window.location.reload()");
  m! |6 \9 ]& L& o$ i+ J; e}/ |, Y8 t' y/ I( e' v

* C  n% o5 d6 {! R3 |; W' S: k</script>

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