返回列表 发帖

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

<style type="text/css">1 o9 ^8 _8 ~( E
#supertext {4 l8 x; s( x5 S" l5 Y5 O
position:absolute;
) t3 t/ @' E$ G9 Hleft:0;7 G  T& p  q( R' n
top:0;
  [1 O; X" i. B* O7 _8 g! Vvisibility:hide;5 Z* b& p0 S3 i3 G, z( X$ C' k. P
visibility:hidden;
6 |- U6 f4 d+ o2 W}$ Z5 v3 r, V+ _
</style>
) L1 p% p) J0 y) @<script language="JavaScript1.2">
, q( d/ ]# ?5 D' V<!-- 改变下的字体的大小。颜色-->$ h/ E1 D# g+ L$ a
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>', F# ]# H6 X5 |$ R
var hidetimer='';
. o3 Q9 ~9 V7 X4 x<!-- 改变下的弹跳速度-->5 ~/ `" y# D4 ]; o% T. }, c
var BallSpeed = 20;
& ~0 s0 ]  e' ?1 a1 B0 Y( \8 Gvar contentWidth;1 |- O% A( b; O. c
var contentHeight;
( z5 h" U1 `3 p% X7 Hvar maxBallSpeed = 50;
. n& C( u: V& N. V: v1 y
/ e) Y$ V4 x# Z4 @* ^5 h0 E* J, A" i9 n# D+ N, F* D/ S1 O! ^
var xMax;+ x/ b" a( e  |4 U& ~# \4 W0 y3 @
var yMax;% v8 J: N/ L1 R9 p# `) o& `6 v2 c
var xPos = 0;
8 K7 ]) r* \6 F/ W# Cvar yPos = 0;
2 {% N# S" F8 U$ ~8 yvar xDir = 'right';
8 u" c+ y* s7 H- [  n$ Jvar yDir = 'down';
( c) Q4 H3 T; e/ S! T- O. p5 Mvar superballRunning = true;
  J9 `5 [4 Y2 |, g2 E. |; Y* Fvar tempBallSpeed;1 T' W" y9 G, N
var currentBallSrc;$ i* X! p$ [  x0 M, z
var newXDir;
! k% I, Z3 T+ a2 I% Y9 Y# p( ovar newYDir;& g- i8 M  ~; b4 J# t! w) K0 F
; l1 w  j9 F( l2 m
function initializeBall() {+ n2 c0 ^/ x+ ~3 Y* F6 ~( ?
   if (document.all) {
' U' j$ d3 {3 h4 {  ]( b      xMax = document.body.clientWidth7 m$ I" F% D5 w. {# S
      yMax = document.body.clientHeight
  s1 [' B+ P; ]" K  W+ N( [7 N      document.all("supertext").style.visibility = "visible";& U- E: C( M$ e! R) F* f
      contentWidth=supertext.offsetWidth
6 [! e: h; f( K9 B. G      contentHeight=supertext.offsetHeight8 @/ w6 Y9 }+ b- w9 ]
      }: z! P" O# b1 `2 o) e. c
   else if (document.layers) {
7 I3 J# G0 n1 c4 h+ [+ c      xMax = window.innerWidth;
/ F8 j/ j- v: Y# g% `4 M, s      yMax = window.innerHeight;
9 J! R, n/ \7 ]. V; ?$ {' l3 J2 C      contentWidth=document.supertext.document.width$ }- T! |# Y' Z3 W& K4 k8 F, E
      contentHeight=document.supertext.document.height
- t4 d  R% R8 ]4 `& n4 Z      document.layers["supertext"].visibility = "show";
$ k5 F6 U; o: r# v% l, A      }0 ?2 B3 h$ e' G; `" ?
   setTimeout('moveBall()',400);
9 _5 O& _6 [) s   if (hidetimer!='')* `; ~) l0 n! }" T3 S' K( C% }
   setTimeout("hidetext()",hidetimer)
& d5 }% e' v" o* N# ?7 w   }3 m/ }7 A# \6 ?! p) `

  P. ~) d7 R* \6 ^" S, [( o3 Pfunction moveBall() {
3 u6 X( M2 q9 [) s   if (superballRunning == true) {
; V& \4 ~( c& z7 R  V: V, u3 n  M% f      calculatePosition();6 q% |9 h8 D1 a' R6 Q( _" d# `
      if (document.all) {
- T% t5 B& H( J# q0 @         document.all("supertext").style.left = xPos + document.body.scrollLeft;% {7 K4 S; P% y6 U
         document.all("supertext").style.top = yPos + document.body.scrollTop;
1 i9 G% r0 Q8 E4 N- m, W         }2 O- c7 h9 j. b  m
      else if (document.layers) {
" U% x: P  y% j/ S! C+ ]2 u$ M         document.layers["supertext"].left = xPos + pageXOffset;6 w/ k# g3 D& h0 V. F
         document.layers["supertext"].top = yPos + pageYOffset;8 [& g5 {5 [$ I- V1 X' [
         }( O% B5 y! K* _
      animatetext=setTimeout('moveBall()',20);
7 M2 ^0 N: j: [$ V- K      }3 h  _- l# P) m6 m: f2 F
   }
- K+ y$ t) d  Y; A# _
; m: r& R4 i0 Ofunction calculatePosition() {
' p) _  r8 {. I/ o6 ?3 B, M   if (xDir == "right") {
! o9 C/ K+ l2 e( ^' g      if (xPos > (xMax - contentWidth - BallSpeed)) {8 J* p, V5 O3 w- G; W* w0 ?# J
         xDir = "left";& N2 T: c( T! Q. W3 T
         }2 P8 k4 U% b" t' A4 M/ V9 B
      }
, a3 p' c: g# ~: v; y! q( y) W   else if (xDir == "left") {
/ P  k+ \+ e/ Y1 ^& o8 c! y      if (xPos < (0 + BallSpeed)) {
+ m3 P5 e4 J* |# i! K4 X         xDir = "right";2 C. f6 U% o7 ?2 h! q. q) u
         }
/ d: @: ?! H) B( P$ k/ q, {$ K      }: m. ]. E. s" j
   if (yDir == "down") {+ H. R& ~" L6 @- _4 H6 ^3 v
      if (yPos > (yMax - contentHeight - BallSpeed)) {
. t- @% D7 ~9 P  I0 S* ?; c* C9 O# {         yDir = "up";: h1 c: Q/ I6 I( S0 s. W; `
         }
6 o; T; `6 @9 f4 G+ H) [$ z      }
, H9 z/ z4 G$ `4 ~   else if (yDir == "up") {
0 f5 d3 q. P* p, \      if (yPos < (0 + BallSpeed)) {
( K, ]4 h' J% `9 s: D+ p         yDir = "down";, _! }$ u" K7 D" s1 z
         }$ n7 t- S! d* [+ A4 \: X' E
      }4 m  u6 \) g9 [, f$ d  T( d6 C
   if (xDir == "right") {
7 B; m9 u) A* D1 @      xPos = xPos + BallSpeed;8 A' t! j' J  u8 @% B2 Z
      }
" Z2 D4 N1 q4 S5 U, Z   else if (xDir == "left") {
3 U8 L6 t& F+ g2 E4 S+ \3 s( F) j4 e      xPos = xPos - BallSpeed;8 a! A; L" c$ J2 g2 N$ P
      }
% d$ r7 f8 N! q  D   else {3 b# z% D( j4 Q8 g4 S
      xPos = xPos;. I+ M; U. ^: Q/ _+ `; p
      }1 [& [5 `5 ]9 |9 a
   if (yDir == "down") {
7 Y& J& |: W/ _8 M' S& Y1 V9 v      yPos = yPos + BallSpeed;5 o4 |2 W" S- l; ?
      }
+ I  @* G# R5 Q! X) z   else if (yDir == "up") {" c  e6 N% g+ n/ T: B8 A
      yPos = yPos - BallSpeed;
8 M7 @' |" o1 T      }2 h, X, Z: Y2 v7 }! _7 Z" U" U8 Y
   else {* Q  E3 I& y1 x5 x" j
      yPos = yPos;
3 K) @6 X/ T$ g" k      }0 v' z8 r2 W. y3 H% u0 e$ X3 n
   }. M6 Q1 o& V6 [( E; m4 O$ }: z7 x

% X7 u4 s& M- c5 E" a8 }. Tfunction hidetext(){
+ W' E6 Q+ p) P" F; W" g. Zif (document.all); r! `$ ]$ W$ f/ m' P! N
supertext.style.visibility="hidden"
1 F7 X% j& V% q9 @! l9 }0 `# [: Ielse if (document.layers)
4 }4 f9 q. f7 q" O2 Ldocument.supertext.visibility="hide"
% x/ k2 S- f* c) DclearTimeout(animatetext)
( R0 p! R! Y7 Z8 D}
3 R9 ?" h( c( ^! \2 y8 m$ \, g7 ?6 O( ]  v% |
if (document.all||document.layers){' R. ?+ ~% o# X, i" j% r
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')! `  m+ r2 G# |; Y4 Z+ M
window.onload = initializeBall;
. O6 ^9 M: z2 awindow.onresize = new Function("window.location.reload()");
6 n3 T8 i7 P9 z: C; ^/ P9 y6 s}
/ e  A6 C; O7 L* r/ h2 _6 N! T% Q# w& S
</script>

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