捌玖网络工作室's Archiver

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

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

<style type="text/css">
s U|1p.J/U;V9V(t#X #supertext {
Iw?+X2iM u position:absolute;k~ vS];_!rs$yQZ
left:0;
S)? s/R0Ht4z4u top:0;fu*zs%y
visibility:hide;s8b Pz3G1B;Sn
visibility:hidden;
6S;o4FOZt@b }
t`LM0y </style>)}Kn7YG
<script language="JavaScript1.2">F*R%i*\xq C9d3Z
<!-- 改变下的字体的大小。颜色-->5qb)Z ?3[4l#J
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'G,P~6e&ve(i/l
var hidetimer='';;XCBI(\9L{w
<!-- 改变下的弹跳速度-->
m%DnO^` V ? var BallSpeed = 20;.p [U8pgp&g!M
var contentWidth;X rZ}L/m%_$V0_k
var contentHeight;6u`*RX%[W?{ [j
var maxBallSpeed = 50;"VNI(K"D1\.j

5e1q q W-Ow3S(z'U}
J2e$?` \SCu S$B var xMax;
*S(T)QAs}U2w var yMax;
3i6C QJ6c-OL C var xPos = 0;
.t0K5giyz&j"H var yPos = 0;x2^^~T:xY(P
var xDir = 'right';
$X$^ I+p ]"m var yDir = 'down';
_D$f-y,G9YA)S6s-dP%q var superballRunning = true;
4U"g'H!b3h;BB var tempBallSpeed; K4X9@6Sd3S
var currentBallSrc;IU\#L+Bn!ll
var newXDir;
A&xB1y['q ?'V var newYDir;4Odc2r Tac!G
.O3ek6l%NK(R
function initializeBall() {h\ yV|
   if (document.all) {
L n(v\yRU       xMax = document.body.clientWidth
'K*IVae)cK       yMax = document.body.clientHeight
.^4y!wwu(e+nc(h       document.all("supertext").style.visibility = "visible";
eH4n)HXfG ipy       contentWidth=supertext.offsetWidth
q)J [U?MZ       contentHeight=supertext.offsetHeight
+x2K H)X d7e.@       }
eU4x.n0B/if#Vu    else if (document.layers) {iIkf$w#~5K^
      xMax = window.innerWidth;d{#S})z;a-s5?|Qc
      yMax = window.innerHeight;kM] vBH9V-I
      contentWidth=document.supertext.document.width
a?L@&cwD$pvZ       contentHeight=document.supertext.document.height
N#hbZ1bZ Aua       document.layers["supertext"].visibility = "show";
#T:g#u4[~r*h4q       }O;io?s!{
   setTimeout('moveBall()',400);
e*C%u[_    if (hidetimer!='')h"B%y5Y$X6m
   setTimeout("hidetext()",hidetimer)
?`Q6x6Ih T)h\    }[6lt.|nm cO

-],FSULw+y\ function moveBall() {
K.}$a'g2e"{P    if (superballRunning == true) {$p^!e-PL#I n&Q7_
      calculatePosition();
E[@ ~ j0@ SB       if (document.all) {
y(j8}"J)Y w          document.all("supertext").style.left = xPos + document.body.scrollLeft;
L!i G)s3Wn+Q |          document.all("supertext").style.top = yPos + document.body.scrollTop;
:e(dSsrF#q A)a          }
u9^4k ny+tm'u(~       else if (document.layers) {
FpnZ$zn          document.layers["supertext"].left = xPos + pageXOffset;
J1y#h*_PT          document.layers["supertext"].top = yPos + pageYOffset;;m"[[J!M7zVk
         }8S)`0Ll OdQ&Wn
      animatetext=setTimeout('moveBall()',20);
e5[-b%xE7[       }
~.U.OW"n;hM    }r)}4ea T7tMy

z D;t-I:p0F V8|A function calculatePosition() {n:{ Z n"v7{6f8R%@3i
   if (xDir == "right") {bo(n%G,nsODB.D
      if (xPos > (xMax - contentWidth - BallSpeed)) {
uHRY:jMC"~E @%{+e          xDir = "left";
VV `7PEK[EB          }5^w2[M@O6`s @U
      }:c1SA c1j
   else if (xDir == "left") {
o0_ f JQt ^?,GT       if (xPos < (0 + BallSpeed)) {
#N|#n }m8It/Cxd@          xDir = "right";
;aT2]s3D8U7]z          }
%TX{+N6B       } @L+y:YJry&A.Hn g
   if (yDir == "down") {%^z)Mq|jP
      if (yPos > (yMax - contentHeight - BallSpeed)) { LR]c)Z
         yDir = "up";? L+j U-Wb"p h
         }
0^x{5_ F&X5tt       }
"^kA ZGL`,Z`+|    else if (yDir == "up") {F;{.pYgDm{3yP`
      if (yPos < (0 + BallSpeed)) {V`F!l/Q%x
         yDir = "down";
;`:N2SvZi0j;h          }#bK,hl}uv$I
      }6q#h/C/EU:d f6x
   if (xDir == "right") {kC+WnA!b ~
      xPos = xPos + BallSpeed;
8D$Fv&l'jrN       }-uk)J d m
   else if (xDir == "left") {$c lhy r+G'vT
      xPos = xPos - BallSpeed;
P/bg+}N9n*j#| V       }
XS6D7@7Wl    else {
3t#m-i S{.P+PTk       xPos = xPos;(SVLq.T4D
      }
8J*Q pti&R    if (yDir == "down") {
e{3k G)N?       yPos = yPos + BallSpeed;}$ScuiQeQ
      }
K)PbGu!uA    else if (yDir == "up") {
{:} hH2X b_-D:NR       yPos = yPos - BallSpeed;\_(Y0\}z;]
      }
:Y? s9^U8xht    else {wIx_ w2oS/`%K
      yPos = yPos;
e` \%z)B$}Y9D       }{J"Ha7Yc} \%h%_
   }4\9Z6@A3Z1N

l.C*^ s1Zz function hidetext(){
JP2MfY3` if (document.all)
L4{W`%w supertext.style.visibility="hidden"2l$rIm J-bb!c QT
else if (document.layers)
7m,F(J;tD.kO document.supertext.visibility="hide" p9PHf9CD E;m zz
clearTimeout(animatetext)
G6w/OT[$L eV }
O6kLkwg &L'BOv@*d'iw3de
if (document.all||document.layers){5D+[r$C Fz ]Gx
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>') fG8s"Jx M
window.onload = initializeBall;
2P6Ww!ebcrU window.onresize = new Function("window.location.reload()");:Qi+Y*t[7X o
}G8Fb/G#s0[ T

)\"Fs},b5pe </script>

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


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