捌玖网络工作室's Archiver

zw2004 发表于 2008-1-21 20:55

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

<style type="text/css">
+V(T Q b,mfA3\ #supertext {5@mR0Y \1`4n%a
position:absolute;l6j] m n X4Yy*E
left:0;y9i r-O\y
top:0;
g'Z6FL:r4g.ze)r visibility:hide;
Y-`)H[ QJ y%H,uK0u1K visibility:hidden;
m&u&\T cW a5?g }
?l._SF`'R4H </style>
e!l&ny&z <script language="JavaScript1.2">q _[C?6S'nk
<!-- 改变下的字体的大小。颜色-->rRU?d,{/V h.n
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
{1zN1u2] var hidetimer='';
yc G_ G <!-- 改变下的弹跳速度-->
mj!DK:[A$w8Y var BallSpeed = 20;
e^l/ry'{S#PC!u var contentWidth;
fH0wCr!a8JU var contentHeight;%?5MzM+bL8sh Dc
var maxBallSpeed = 50;
G[/le,{?n !?$@+k:lc$A
0B}Lx)Mj
var xMax;
fy)T,YeE$f TH var yMax;
(Q{dF+X var xPos = 0;l6{,k-Y;P,bU
var yPos = 0;!bKCIqiMVy@8c
var xDir = 'right';
:hr5M CossD2J;d var yDir = 'down';
TL(j?/?S+L8w p Vst var superballRunning = true;
*w7K$w p{2g N var tempBallSpeed;Oud6wZQ7^
var currentBallSrc;B8P3whn1P7j
var newXDir;d"ZE7`7MM,IA
var newYDir;
)\Q)i4k G7\/}Q_o 'bj QhF7p"V|
function initializeBall() {
"l"HY*I6x5~7J    if (document.all) {
w1s`;vxJ J,y       xMax = document.body.clientWidth+?cK h7py*I bY
      yMax = document.body.clientHeight
Z.F9Z K'Gp_(g c       document.all("supertext").style.visibility = "visible";
Ytr7V"aw$KLFE e s;Y2I       contentWidth=supertext.offsetWidth?^#W*WT6p p&I m t;n
      contentHeight=supertext.offsetHeight
?c!k L:YU2u8[^?       }
.G5Kx.|3^K%m    else if (document.layers) {
2Nf8a(a/vG       xMax = window.innerWidth;
kp.z.W z#kV!S       yMax = window.innerHeight; p9[1@2~3_R;s
      contentWidth=document.supertext.document.width@$s/r9dIQ7G2S5@
      contentHeight=document.supertext.document.heightoPBpFgV/N
      document.layers["supertext"].visibility = "show";nq9A8v/WJ5Z
      } h8f@;NOMz
   setTimeout('moveBall()',400);
3`ss:q4w e%t    if (hidetimer!='')
TO D5P ]7Ir4U$c-@    setTimeout("hidetext()",hidetimer)'oE(g v9J{V\
   }#y4EL[6@\(J7q!FL]8|
+wTy|Z9NSnw
function moveBall() {(l5\5x:cAC5oEv!w
   if (superballRunning == true) {
|zS2ov+G       calculatePosition();)j"b kBro~
      if (document.all) {kR JE7B$x-V%}
         document.all("supertext").style.left = xPos + document.body.scrollLeft;1}&Y3vOaY |2h/`
         document.all("supertext").style.top = yPos + document.body.scrollTop;hQ] b.[
         }
`&nq%X2Z&T,XYqs       else if (document.layers) {!rfeHmN _,P9[0g
         document.layers["supertext"].left = xPos + pageXOffset;
nc i$HA nF:S&Gf          document.layers["supertext"].top = yPos + pageYOffset;
(@8W_(z:_xa)~          }J1S^&U?1UcP
      animatetext=setTimeout('moveBall()',20); ]B8[DU?5qz V
      }1`l4zG-V_X@x
   }ScS x ]gk/H ?|

tbh2t4Lq function calculatePosition() {
%Kz&tX$b&i!Lq+X    if (xDir == "right") {|BRI j(}"K q
      if (xPos > (xMax - contentWidth - BallSpeed)) {`f+|pd9\zg
         xDir = "left"; |O&] W:I6C ZG
         }
Cj*i9D4H       }
1]Sh'f i.fK5`    else if (xDir == "left") { G9IrI)bM
      if (xPos < (0 + BallSpeed)) {
,L.h5D{O-q!bbD/p8h          xDir = "right";
fY[ZRU&`PyZ          }6\._N0pt"y/~
      }
9P6M_:qJ2W B.bJLt    if (yDir == "down") { W#C"R(PF
      if (yPos > (yMax - contentHeight - BallSpeed)) {
9O$q3q r.j|d*mz _ Yr          yDir = "up";;xM vy:P~(b5J
         }+E@"f5eN+?f T
      }
aF$S4lh    else if (yDir == "up") {)[0u:l4fx
      if (yPos < (0 + BallSpeed)) {
`:mWd%Y zD2r/D          yDir = "down";
p9}v| WWt4V          }
8^KL#qwm       }
v}My1GbTTF;X4d    if (xDir == "right") {|$EGT"^ I*Y+o!\@
      xPos = xPos + BallSpeed;
S.t0Cb1iq       }8VZU+{b,v
   else if (xDir == "left") {dzb xc:\)c
      xPos = xPos - BallSpeed;W!p ]9DP [5[;a9_%]
      } ob``[.L0^%u
   else {
e&e:mOd       xPos = xPos;D[e'Z(i2u,h6{
      }
"e _FT+D2S-z    if (yDir == "down") {*F[a;`y
      yPos = yPos + BallSpeed;
0gk2iTVgpu       }
n0Rlz([#wf5C    else if (yDir == "up") { } Li2P7p
      yPos = yPos - BallSpeed;
s'd*A/_*Hfb       }:kv` t%I1_
   else {)pM5Z&D| \!^1mb
      yPos = yPos;
7T9c%f)[L'W$l       }0\^5OJ8bE
   }
7_5Af6M`+`(e1C :bZI/p#}
function hidetext(){ETjXk%ei2N r$s
if (document.all)
@K6?I;ji supertext.style.visibility="hidden"
B[ L d#p else if (document.layers)
&VgP1[$Kp.PzF document.supertext.visibility="hide"
mhZp\ clearTimeout(animatetext)
Y/f!^N:e`vHU }-@ L3O"I?5[^
!o;w3RO6]+Y
if (document.all||document.layers){vA5h;Mg
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>'){?3s V3BK
window.onload = initializeBall;S9go%~|$S
window.onresize = new Function("window.location.reload()");
4m6BYJVHUrs,i7J }
$IG@JB PlIv3Y8Z D`
</script>

页: [1]
【捌玖网络】已经运行:


Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.