捌玖网络工作室's Archiver

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

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

<style type="text/css">X/] hcYe3PU
#supertext {c)xQ#Z6}.RK:r
position:absolute;
5ocyQ1^8aZ6s left:0;
~7Y1`"eU4B m}"vH.T1] top:0;
Jvy_5P z ~Kl D,h visibility:hide; jwT S'Y4c$h
visibility:hidden;t(~5^+m U
}
l"_!XP }4\ </style>
\q,d~2x!LK <script language="JavaScript1.2">
.F3CPGjVd <!-- 改变下的字体的大小。颜色-->&Q#yx+M^-oI[wWK
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'}1~$WCv
var hidetimer='';vY/uf4|/h Xz M~
<!-- 改变下的弹跳速度-->
I7j)`h bO k var BallSpeed = 20;
.`uA#~5s6J$M:M var contentWidth;un'Rl ag-d {X
var contentHeight;:ajU)u(z5Rz!A
var maxBallSpeed = 50;
Z&FatVaM~ UM*b ME @
RN/g-}(z8D;Y9xp}
var xMax;A:J?l zJ-Id:v8Z$k4S
var yMax;J1D3?4qqp'N9X
var xPos = 0;
8|/k/W!zYa:hL/k,G var yPos = 0;-M4kAzoi
var xDir = 'right';
3m+iY {w \ | var yDir = 'down';N.T6hR3CPj/O
var superballRunning = true;
O~E8E`#e!T s,D\8? var tempBallSpeed;&q,?:}.Z5`'}`3O }
var currentBallSrc;BHRE{g(SS
var newXDir;~Y E.R_T
var newYDir;2|!Uc)A2MJ^+m

LB V)wH0G8X+iBC:S function initializeBall() {+G!A C,\ gS(v9S
   if (document.all) {
g;mnF1O"x6F(B kB4M       xMax = document.body.clientWidth
1YQ`wCT)EZ!D       yMax = document.body.clientHeight
v-CCYRN[,c       document.all("supertext").style.visibility = "visible";
v0LR(VX8{mr       contentWidth=supertext.offsetWidth Y([HjNq1RQ
      contentHeight=supertext.offsetHeight
O/?t,F'n       }
_#bC#z!J,VA\    else if (document.layers) {
e9rzOQ {:L       xMax = window.innerWidth;1b2H$?"o-X R$i
      yMax = window.innerHeight;
&I5k%R'F9C:UU       contentWidth=document.supertext.document.widthleJmH {!hUp-U-M
      contentHeight=document.supertext.document.height4pn_xV}3yMS
      document.layers["supertext"].visibility = "show";RQO'j'[Ff
      }
$m$@'W~au,\8p-a    setTimeout('moveBall()',400);
1xY'IDq*I    if (hidetimer!='')?5`VE{4}m&iqm u
   setTimeout("hidetext()",hidetimer)
k |c)_GQ%q"a    }@ t|LJ(E4w*G
f%~gsu)N
function moveBall() {
4M%cN3K9NN    if (superballRunning == true) {.l%e+i3U|)G
      calculatePosition();
1cT Oq6H!t^`(~       if (document.all) {
yu&~"[9l          document.all("supertext").style.left = xPos + document.body.scrollLeft;
6BO!Av?H          document.all("supertext").style.top = yPos + document.body.scrollTop; xjn{PX9Z ^2w
         }nk)B.p6k)q*l ~i
      else if (document.layers) {
mI0P/ZBaG;@X          document.layers["supertext"].left = xPos + pageXOffset;!kbE*Q@~l
         document.layers["supertext"].top = yPos + pageYOffset;
7Q4la*HSgEy)PD          }`$yEO&Qo+?a?u
      animatetext=setTimeout('moveBall()',20); Y$a*Yw3O+pC |(~G
      }
3Z_0^E&XK    }7fg)E/|hzz

}ijGC+O`.a function calculatePosition() {+S Iy+E)w+p_ZW
   if (xDir == "right") {0z+`*tJ} v8b\
      if (xPos > (xMax - contentWidth - BallSpeed)) {
^|0h(XQoK^          xDir = "left";
iCAhvH:F{          }
P|1ARi+C3w       }#K e)e3K}
   else if (xDir == "left") {~-W+T_/Y!g
      if (xPos < (0 + BallSpeed)) {5uK/psD:F:S
         xDir = "right"; nV.P1S\c-U/Y K@
         }
o\/e$c+` T.nM       }$v%j;Q)Io:^B-x
   if (yDir == "down") {%S? \E$]
      if (yPos > (yMax - contentHeight - BallSpeed)) {
r8Nd&fc5fV          yDir = "up";
lsyV,vu1V          }
qU [-D*irp^-b/m       }Dv']L,xag@!x+gb
   else if (yDir == "up") {O3B `l G7s\
      if (yPos < (0 + BallSpeed)) {;Q `Kg H ]4y r/E
         yDir = "down";(obi1c%iw;k
         }%S7zI:h2}
      }}8K ~h*s%dp4M/Z
   if (xDir == "right") {2t$z wh L-q7W
      xPos = xPos + BallSpeed;
-lS!gEY       }
n~T#E$z4zid    else if (xDir == "left") {\:mF_-k%?5q
      xPos = xPos - BallSpeed;?r9]+jH.gNU
      }
0_'Qm:W3JA.M    else {4`~!TBV\*TS+[E/[
      xPos = xPos;J:@.JGDIkN6I P
      }
/E/oseF1[:h    if (yDir == "down") {G;B;T ZF ? \L8P
      yPos = yPos + BallSpeed;
3bY w R#W&S2FZd       }#T bc S.h-d5v$r
   else if (yDir == "up") { I%\b,{\)B V
      yPos = yPos - BallSpeed;
B6_;s5I1H E k       }9NF-@#h;L7r!B't)L
   else {)T(aNPy r
      yPos = yPos;1P b0Y$s p3se O:ns
      }B%KTn(L`Y%z9\
   }'IK6UR$QnH

"mE/v\l7iV function hidetext(){
8Z-R@8xn*v if (document.all)3CUcF{RT d
supertext.style.visibility="hidden"nCNoW%|]w S
else if (document.layers)4g fPQ c;c"u&i
document.supertext.visibility="hide"
-f3J%S7sXU clearTimeout(animatetext)q e,{%E&R9s
}
Q@T:N&l4K'X3Z!f7Q6\}
n[9N5b#IT$N if (document.all||document.layers){:C~ ~7RA"u(q!e/o
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')h Jzx/S@
window.onload = initializeBall;[Y"? U] N L#p!e
window.onresize = new Function("window.location.reload()");
A-ewV'iO!x }x P.vS|*H

K v.y!X;nF </script>

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


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