返回列表 发帖

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

<style type="text/css">
: a# [1 V0 b/ J9 j#supertext {
1 R+ v4 L  G6 Iposition:absolute;
( x8 R2 Q, e( S0 gleft:0;) N1 ?, v  r  N$ j  u, m. k
top:0;
7 E' u( \! j8 _: T* i/ j4 [visibility:hide;3 p9 d& Y6 P) O1 k+ R+ ^
visibility:hidden;
3 ]& c+ Y% ]" V( d- o}& I4 a. l( c. e& M' y
</style>
# ?8 H9 \, R! S# E. s2 Y<script language="JavaScript1.2">& I' d0 S4 e3 V7 k8 b$ E
<!-- 改变下的字体的大小。颜色-->* {& ~* t4 G- m8 \1 L( Y
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'* @" @1 i( n( a8 w" Q/ M
var hidetimer='';
4 e- d: o3 S8 ]( B3 b0 n1 V<!-- 改变下的弹跳速度-->5 ~, c9 A; |0 N' a
var BallSpeed = 20;5 ]$ r) _. n; w/ S8 `  D
var contentWidth;! X' b, ?; K1 B! U- L
var contentHeight;
# X6 ]6 y8 v' z4 lvar maxBallSpeed = 50;
+ f2 v: x  l" g+ Z& c/ }% D# q5 P
' e! V( H2 ?/ w6 p0 k7 x
( X: Q# x, R9 r4 W; z) d) Svar xMax;% V' r# I% z' |; c% n0 B" G9 \/ I, S
var yMax;: `8 u; J6 o% C7 J; K' u
var xPos = 0;
* ?7 O& t: M: K& y2 h- Avar yPos = 0;
" m$ e+ e" \5 s- ovar xDir = 'right';6 q' S5 n  p, s- K
var yDir = 'down';
& f4 ~, V, L6 k2 R( q0 Vvar superballRunning = true;/ _2 f3 F$ d4 G# F" ~! |
var tempBallSpeed;: V" c5 X1 w- t
var currentBallSrc;
; X, a' z/ h# T: S4 qvar newXDir;
4 Y$ u# q8 u: U: U$ Lvar newYDir;
2 U4 r& g/ @5 c* N* G. x6 f: L, _9 v; K3 V
function initializeBall() {6 V3 v" [* y) y0 y* p' X
   if (document.all) {  S9 I! N" E( p0 Z- d8 c
      xMax = document.body.clientWidth0 w9 l  u8 u4 h% w
      yMax = document.body.clientHeight
9 y: G. C' |" f$ M0 ^2 O      document.all("supertext").style.visibility = "visible";9 a  I6 `' W& L/ u7 d* E
      contentWidth=supertext.offsetWidth
, ?( D6 W4 E( o' H9 v. p      contentHeight=supertext.offsetHeight# ~" i" U5 l* I8 n
      }
1 b7 m, G! j, E1 p1 F( H8 g   else if (document.layers) {( S4 g1 V, k! T9 P" A
      xMax = window.innerWidth;1 L# f6 F" ?3 ?. c6 U# M
      yMax = window.innerHeight;
6 J: W8 I1 L- {      contentWidth=document.supertext.document.width/ Y* i. }8 x& L; S7 Z! g
      contentHeight=document.supertext.document.height1 F. `2 m/ F0 y2 C9 o
      document.layers["supertext"].visibility = "show";+ q3 _! E5 o3 a! ]# |+ Z+ d9 |: H
      }
2 \- t7 M$ _- S- Z$ P! U2 B   setTimeout('moveBall()',400);
- u8 ]  Z* B7 o2 S. R& U   if (hidetimer!='')* H/ G* b; T/ A) Z* M4 E- w0 o" g
   setTimeout("hidetext()",hidetimer)% C4 m% r' S8 q1 [! w2 N' r- ~3 b# k* I
   }
  z5 O. Z* M6 _2 a; `% W9 k- A
4 ~& {1 }1 e3 ~. B# s2 qfunction moveBall() {$ R& X( B; v: j& V8 D
   if (superballRunning == true) {
7 k+ n" ]1 \. Y* n1 t6 d7 g      calculatePosition();9 _+ A6 Q' V  J0 }) _5 @. Q, g
      if (document.all) {8 A1 k6 s8 @( E6 S( [
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
9 @' a) q% S0 S& S0 F6 G8 [         document.all("supertext").style.top = yPos + document.body.scrollTop;, g5 y! H1 s8 u7 s2 `; C& D
         }" c8 d. j0 ?" W& \4 e- B5 ]. @
      else if (document.layers) {
" Z, `7 Z. t# L7 M5 u         document.layers["supertext"].left = xPos + pageXOffset;
1 Z& K$ \5 p* q3 [3 S/ W1 }3 A         document.layers["supertext"].top = yPos + pageYOffset;# r7 }4 C4 j+ C1 x
         }8 I6 M, b; j+ q! T9 V" ]
      animatetext=setTimeout('moveBall()',20);
& U0 \  q1 G2 P% R9 S2 a7 a      }
' n) g$ D* M9 o" [0 V   }
5 r" a: ]4 F' T/ {/ j) A& v% g
( b1 W" Q7 W* S5 D0 |7 t# wfunction calculatePosition() {) F& T) `1 o& D8 V# l* T
   if (xDir == "right") {8 j' u3 L" a- A+ q# K
      if (xPos > (xMax - contentWidth - BallSpeed)) {( f. }" v" _! A( u& ?- |6 N+ X
         xDir = "left";0 C& a% d7 l1 `7 N3 @# g3 H- H
         }! x* R9 f& @! @
      }
: m' C! k' Z# w! y8 O& ]   else if (xDir == "left") {! L9 j3 _. D; T9 W8 P3 w. O" A( E
      if (xPos < (0 + BallSpeed)) {/ {% `: k0 f# }# e( ~0 ]
         xDir = "right";
5 r! z" |- }2 I$ n& `1 |5 @3 \" c: Z         }
  a$ b  t) t' K      }
" W- C+ s8 S( [* L; q# i3 o$ X8 _   if (yDir == "down") {
- \1 M$ P1 m* Q, t      if (yPos > (yMax - contentHeight - BallSpeed)) {$ d6 r4 s  k( f' N. R2 d1 Y6 y1 }, ^
         yDir = "up";$ u2 c2 v" R- `5 {& k7 T7 T
         }
) ?( h4 M% B: r      }
4 ]. t* N8 F( r   else if (yDir == "up") {
' @" z0 U# d0 z3 m8 G/ N! k, H7 U      if (yPos < (0 + BallSpeed)) {
% _7 |; r5 P, G. O         yDir = "down";
5 Q7 L( B3 P* k, @( O         }
, i/ A/ v5 o+ H; g% a1 E# l! Q      }
3 ^! q8 Y9 [: j9 e7 }3 r( c   if (xDir == "right") {0 ]9 C3 O- H3 {
      xPos = xPos + BallSpeed;
8 _7 ]5 h: E! d- t      }4 I9 C+ g% z5 o
   else if (xDir == "left") {
: }; D3 }0 ~+ a' K      xPos = xPos - BallSpeed;
6 c9 @& {" F+ ]( F      }$ m, A  Y2 u7 a
   else {. l6 L) ]' P9 ~5 i: c
      xPos = xPos;1 w9 M, H0 {) U7 ~8 A2 R
      }  J& U2 k5 G+ l+ s& t7 |
   if (yDir == "down") {9 |* I8 h1 n4 t, X" @% [( {
      yPos = yPos + BallSpeed;
' Y$ [- }( a8 R5 A" E      }& S  E' ]; g3 H
   else if (yDir == "up") {! X1 F. a9 U) C: [5 y! E
      yPos = yPos - BallSpeed;
* _9 D; U% p* s* S- _      }' C' H8 h3 r( L+ ]8 c
   else {8 c9 k2 {8 M6 p. C, N' ?" h
      yPos = yPos;5 T% {8 `2 X; G9 O; A
      }4 F7 B, K8 D7 W& v1 W
   }# O; N* Z9 L+ s) v: |1 R
- k/ Q6 `% x/ T$ l, ]
function hidetext(){
, u  a1 W# R6 h: E/ u3 b8 wif (document.all)3 t9 k8 G# m( p4 Q6 h% D- b
supertext.style.visibility="hidden"$ N( L. U0 ?' p: {
else if (document.layers)
/ m8 y' w- V8 W4 x6 s) R3 Edocument.supertext.visibility="hide"
0 B8 {# {2 i, X* C" z1 B$ [" u) yclearTimeout(animatetext)! z, _7 S% _. X; t. w1 L
}
/ }) c: C' e8 b2 e' J
: s- k! i* ]2 `if (document.all||document.layers){
' x6 H) L' C' i! m) O0 wdocument.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')* n2 n! L4 ]! }5 P% |( U
window.onload = initializeBall;" M0 z2 A" \0 Z4 [$ E
window.onresize = new Function("window.location.reload()");
% A+ ]7 Z* L; e9 @& g}
# H! X- ]; H8 o/ e* Q& e/ |5 t( G! r( c7 s, \4 {! l
</script>

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