捌玖网络工作室's Archiver

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

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

<style type="text/css">
gDMZ\ U.T,V7@ #supertext { S H&_7mfP
position:absolute;cCV:n&|CT
left:0;
J+SJ?g$P-V C%B DD top:0;
-x5B],lz-P/?:^ visibility:hide;
_#[ IgR*B5gI visibility:hidden;
DpW`Hh }
:D*Qy]#FQ{ </style>
0O]*A4s r _q"c;nDo <script language="JavaScript1.2">
lBmJ r6zkzTP!e <!-- 改变下的字体的大小。颜色-->p$K;H'W-|Cnq'sS:[v
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
| I~ v.D N var hidetimer='';3Z,d,s%lT A
<!-- 改变下的弹跳速度-->
i0{-@z l?3P1lo`_6u var BallSpeed = 20;
1C/V\4H"Am1[i.I var contentWidth;jr/|pIa
var contentHeight;
"J/\h&r%Xa5fFm] var maxBallSpeed = 50;
M3_y#g3o(j
3vMH D&H ?,a(Y?J{E'E/J
var xMax;
bA8O.I[!F _6B^ var yMax;
j5oGf^uG1johB var xPos = 0;
~}5Zq5MX(J }@ fN I var yPos = 0;2k,_;gH"O2p
var xDir = 'right';
_Pc0{ z;j var yDir = 'down';
E o(y l&P*]V0N var superballRunning = true;!m`Z+R*`? `*FQ
var tempBallSpeed;| y9k0l-vd}/~0bo
var currentBallSrc;
[} d-vA^ var newXDir;OpT+]rO}p%Y
var newYDir;C y{X f(S

Oo:mB7yR8q!E"E'O function initializeBall() {tL B-SYrcF)s9y
   if (document.all) {)E'M2eB'`7G
      xMax = document.body.clientWidth
T(Flp+Lb;?,`Dq       yMax = document.body.clientHeight
z)fO;o'vF M       document.all("supertext").style.visibility = "visible";-f/b8[1~ W8Zi sJ2P
      contentWidth=supertext.offsetWidth`6y.c7M3h;E
      contentHeight=supertext.offsetHeight
Fbnt)u ~5}a       }
W{-Y'\BU,U]    else if (document.layers) {&{)q2E$|?.Cg3U
      xMax = window.innerWidth;
m)od/si)v7V       yMax = window.innerHeight;6SG \8B z-L8VA.z
      contentWidth=document.supertext.document.width1y"g6hK])s7qY'S!}_C
      contentHeight=document.supertext.document.height
? o"X0c*c6N]       document.layers["supertext"].visibility = "show";5@bu)}*mu6w4s
      };M$@/A v.y:r_E}x
   setTimeout('moveBall()',400);
9|jw4@&v?-v7nW    if (hidetimer!='') o~)l y l bC D+[
   setTimeout("hidetext()",hidetimer))K5TA$e WaC
   }
&HSMv%`k E7E/J3~+r#g
function moveBall() {4PTn){1gK
   if (superballRunning == true) { T~B F2n-vS9o
      calculatePosition();
bbOM_;oy&X6V       if (document.all) {bTt? Uq&J)l+~ k
         document.all("supertext").style.left = xPos + document.body.scrollLeft;&U)K1|M9p
         document.all("supertext").style.top = yPos + document.body.scrollTop;][3C!nD
         }
@ Z2u1gpUtS"~       else if (document.layers) {
2sRx+AdPA"uu i          document.layers["supertext"].left = xPos + pageXOffset;
6y5k9~3` js L M          document.layers["supertext"].top = yPos + pageYOffset;!WL|h|:f)]N ~
         }@H*L3U,AWg
      animatetext=setTimeout('moveBall()',20);c%JX3lU
      }
7I2W\B9T ~T/z    }@W@lb's+{

i#B W~*pZ UP function calculatePosition() {6i)Rh'_x*C V
   if (xDir == "right") {
.B;gy0TG"v-NQc       if (xPos > (xMax - contentWidth - BallSpeed)) {
C8w#_ n!\*hmg          xDir = "left"; ^y7E B` M`@
         } m[Hb6NGj%S
      }(NGu N^
   else if (xDir == "left") {2|k2@"~pnLuW
      if (xPos < (0 + BallSpeed)) {
*lf(s#G)m!f          xDir = "right";Gu``z/[
         }
[G.O9d1T0V       }
ZG w!G2m ] ^dER]    if (yDir == "down") {
:[`Izw5KU       if (yPos > (yMax - contentHeight - BallSpeed)) {
_2Z P Fz$tF          yDir = "up";&aHa!MH.Z3z
         }n s |0T"Ep
      }s_$C p[$U(r"I
   else if (yDir == "up") {9D:e;wj!}
      if (yPos < (0 + BallSpeed)) { a!A9ny2x/PF
         yDir = "down";
5C`B)K;p?o          }AM7T3drDU xx/]d
      }
jp%v3Ah    if (xDir == "right") {K P'A+N)TU
      xPos = xPos + BallSpeed;a9ca h$bM:x
      }?2PX c;BNq P
   else if (xDir == "left") {
6\ISyo\h2WI       xPos = xPos - BallSpeed;-K(h1_ FnQ f)u
      }j|$MA Q/]X${XX j
   else {
X5Z`5_'A_       xPos = xPos;
)r? e%D0h iX|       }*Bs yV@D(B"mKK
   if (yDir == "down") {
7]8sc:hEV       yPos = yPos + BallSpeed;
'Z(~ Bh)g[VK5C       }
(O!]E9I@\    else if (yDir == "up") {
[B(Z_0j#icA_}+J       yPos = yPos - BallSpeed;
a o-K9p8^a       }
_ z0w.[:wp    else {
tC'`8F@gb       yPos = yPos;.Q} p(c$q
      }
!Tt'm,tvR["[    }
l:Md-G,o!M6p;O
||&Ket function hidetext(){nQ4l3M'C/v"O
if (document.all)
w9GOrn;x8a!eD&SS supertext.style.visibility="hidden"
GY o f7A&x7l else if (document.layers)
wYDIE.sR document.supertext.visibility="hide"
*g-c7F-]m;K clearTimeout(animatetext):H6\9vH-c Q|K
}7v(M)y G6}%jI2k5NBk
vH0CQ!UDI9n
if (document.all||document.layers){ ^-G _,{CXQx!M
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')b;a!h"Q4U H$N
window.onload = initializeBall;s!quM0^Or7N
window.onresize = new Function("window.location.reload()"); O$^-R3M[u6CZ3Q
}
TBW6| a!YLg@
4f)W/[L%Z]P </script>

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


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