捌玖网络工作室's Archiver

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

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

<style type="text/css">
y?vi*v~+G #supertext {
uE3SKs1?2D#l:U position:absolute;'[-`0Kf)L%bA
left:0;
]L'T;P_ top:0;1c:Px]ms&DC(M\
visibility:hide;| d%`&l]w] E
visibility:hidden;
?[~9} D$]j.L }
N gR"bY-i </style>W V;K$Au#qPt
<script language="JavaScript1.2">]F,]:W?%S(rsnm
<!-- 改变下的字体的大小。颜色-->X I(?1E)b.@#Z
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
9X%^}k\?|"L var hidetimer='';
A%P'g u-YoZ;|)NfD <!-- 改变下的弹跳速度-->/WYJK5G;d7A ^
var BallSpeed = 20;8P&T B^mIp6h l9Y o
var contentWidth;
tSIS6IU uN] var contentHeight;9H/z8c#r S3y]@I
var maxBallSpeed = 50;`"pLNo0Y

C'\y$`S L
p%]'X j f.~t var xMax;
Drj&m{9R var yMax;F6K%qf N W$O9~
var xPos = 0;
#g9k'@Lv var yPos = 0; U(w e3~9?!k O K/y2?
var xDir = 'right';}{0EF:\bb x
var yDir = 'down';8\BOk+o;c.XM
var superballRunning = true;
$Ni!d} V ] n9oK var tempBallSpeed;
;t8O:tCiy Be9yK var currentBallSrc;
ESY|6C1EUD2hC2U,? var newXDir;#PLGf ~
var newYDir;
"Ko7O0kH\
)rKA| TR1n function initializeBall() {o(isn8B3[1s
   if (document.all) {
t^6y{C f%E Dd0OT       xMax = document.body.clientWidth
O,oyZ2b+^l |       yMax = document.body.clientHeightv.f?^yAMs6gG
      document.all("supertext").style.visibility = "visible";
"k2`r%ap*fG3\)}~       contentWidth=supertext.offsetWidth:qf5tw9\!hEq
      contentHeight=supertext.offsetHeight g_:^$_Z:k
      }R L7]}z \gp eCU
   else if (document.layers) {UX9RF{9W
      xMax = window.innerWidth;
)sM ` a/W/f m/bc       yMax = window.innerHeight;
)\ QKSzq"XX-b       contentWidth=document.supertext.document.width
F%?Vq;Q9Dw       contentHeight=document.supertext.document.heightP%Z Ci$^#hBb
      document.layers["supertext"].visibility = "show";)d7uUq;R^
      }+Gs `!yY[0G)E~@p
   setTimeout('moveBall()',400);
@{+| y T;u    if (hidetimer!='')2o;Ok_R+~
   setTimeout("hidetext()",hidetimer)9OyMH.}
   }
!e.[6p} Wvk N,I7Q@!M r r
function moveBall() {
9qY3_"gqy;F'X    if (superballRunning == true) {
|[xNsZO&Y s4D       calculatePosition();%K3Un w3b iv
      if (document.all) {6dy-m9Z[0z.Izx
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
W#ipD*`          document.all("supertext").style.top = yPos + document.body.scrollTop;
_R9Bwp3\#X c3D          }`'|T]x2Jt
      else if (document.layers) { T#z7k2\2}
         document.layers["supertext"].left = xPos + pageXOffset;{ FFX#h|q
         document.layers["supertext"].top = yPos + pageYOffset;
.C}:Y)~M&Av          }st2b6Ai:q)A
      animatetext=setTimeout('moveBall()',20);
1{#UB+IV)|w c       }
(W9g-sSC_)H)l    }
"~Zc|T%Kw;Y@ a;m#s8re#T%nL5k*[
function calculatePosition() {
E&\tx#?RQ(n&s    if (xDir == "right") {
(AQ-NQN       if (xPos > (xMax - contentWidth - BallSpeed)) {
P*OtEZQ          xDir = "left";x(] WbK ]
         }
l2e2PR X W       }
Q UH)I'@!p    else if (xDir == "left") {
qF@7h_3p}       if (xPos < (0 + BallSpeed)) {
$B#RVQe&`z          xDir = "right";
*}%W4G@rs nV4x!y          }-L |!Dg#TiBvbi
      };Iq0r,S&xy
   if (yDir == "down") {(g}adhh
      if (yPos > (yMax - contentHeight - BallSpeed)) {
(HB#IY]i          yDir = "up";7Qj(m|N%HS;cH
         }*T\ nl-J
      }
~qm E){    else if (yDir == "up") {
q)L#o \GT/r]/j#^       if (yPos < (0 + BallSpeed)) { r5H`/F'|$W$d ~G z
         yDir = "down";
EZ tcTD"g2D nf          }!dv\7N$?
      },R}8^d8_!c
   if (xDir == "right") {$Kr6P"T;k@ \8kB
      xPos = xPos + BallSpeed;
W/aSp.j!w       }}0oyB:B#Yu
   else if (xDir == "left") {0VZ)AKi^0L
      xPos = xPos - BallSpeed;1d2M$`:R+X+O
      }3i6Wk,LR^-i
   else {(X$\1T)u ZR
      xPos = xPos;
&GE*ze e^       }G(R:Ti;_
   if (yDir == "down") {
/pY ?A7Mc0N#[;F       yPos = yPos + BallSpeed;
\+L Q7D#QG,a KM J       }
Sb/^&L T&iP+z,U.P    else if (yDir == "up") {]+siVmQ#RX
      yPos = yPos - BallSpeed;
-M*doqP"Nat       } Z+e }np;j}YB
   else {d0m"E\7L!vdq
      yPos = yPos;
)sC/U4@.B       }
#p t8^'dSYu8h5G    }
gn)l/f-`^;L0A N 7\7mXjzx m
function hidetext(){!J2|m9S!p;X;^;CW }-f
if (document.all)
,~F,df-B$NLX supertext.style.visibility="hidden"
G3m2iu;a7C!n'F else if (document.layers)
*a$m_~$jeC{~0b document.supertext.visibility="hide"
[:yDE3Vqn clearTimeout(animatetext)
.]'{Y7CQR$WW }
mEBQ:X^|/z-]
h Q cc:q:[ if (document.all||document.layers){
*Kq+R"xm.NF document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')@kz!w^
window.onload = initializeBall;m MV5_oo9K
window.onresize = new Function("window.location.reload()");S~ PR"Vj
}
/e9u0vM7?&FX:_3FR tHWYF
</script>

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


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