捌玖网络工作室's Archiver

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

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

<style type="text/css">
u)t2c)?![rff #supertext {K6u#rS,BCa
position:absolute;
E2i}C*d&P4Z left:0;w5C'Q~D_
top:0;
8V P8F'gl q%} visibility:hide;V!_1p4l;o
visibility:hidden;(f3[U?kz#|3a
}
*h ffv\X8pD!_ k </style>
7K!M*Eo3|,f L <script language="JavaScript1.2">/KmW fBo2` w uM
<!-- 改变下的字体的大小。颜色-->
0Uq8L"b*K#[ _"Y var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'1~y'H OxYHO*u
var hidetimer='';.A cmWRl/]%n'^5v#O
<!-- 改变下的弹跳速度-->
#d-yx*xU~I/H var BallSpeed = 20;.E4|S/Un(J
var contentWidth;
4w`;RzN3O4w-r6Hz8M var contentHeight; |4q]6N[D6g-b
var maxBallSpeed = 50;6I*l3p/w,x[d
h8k/C\7}&t|
j{['G)s_%G F!J7K-[C
var xMax;
q `+VV/m$Q var yMax; ` } Yp'Y7S#Z Q:Wp
var xPos = 0;t r6FA-C%s0sZ&U
var yPos = 0;
9RQp;u?uIe var xDir = 'right';Pn y}5GGX&x rh`"?
var yDir = 'down';(z$?/O7F&K],~L i b2E
var superballRunning = true;*GxY&ZF/cw
var tempBallSpeed;
.x8s bQi rw var currentBallSrc;
P&T z r \o p var newXDir;
;} s;h8~F \*R,? var newYDir;^,m!{wX"e1p`

n_ M5N XAj'Re3E/a function initializeBall() { pW/r6JI2x MK
   if (document.all) {!~t2i.Av `+_
      xMax = document.body.clientWidth2K/Z y6I,f5Hqr Q$qO:l
      yMax = document.body.clientHeight
2P[%o:rHn!x Oy l       document.all("supertext").style.visibility = "visible";(_-x]+g7g(B*d
      contentWidth=supertext.offsetWidth:Zw,r5]/_r0T
      contentHeight=supertext.offsetHeight
#pa1Kd"l7m m       }.U M!@"m,A
   else if (document.layers) {~"Hb}"U A$j
      xMax = window.innerWidth;1Eu ^/d n)i;U
      yMax = window.innerHeight;
O"|3IE `T+?R       contentWidth=document.supertext.document.width^!y3N3w CV
      contentHeight=document.supertext.document.height
+{'AeQJ(`V       document.layers["supertext"].visibility = "show";Mt1vT0i
      }
Hl D+] {-T    setTimeout('moveBall()',400);
.`nPy+RK"rd    if (hidetimer!='')
PV+P$yK4Z b_    setTimeout("hidetext()",hidetimer)}&Z8xh"jQ9S:^ Pp
   }6](R]0EAl$B&Y)k
,U`{rg1U5ul!o
function moveBall() {U`+A%f[;`hY!s R
   if (superballRunning == true) { iX2|Vi~$X:C\
      calculatePosition();
ha#d~ G#nS5N5P       if (document.all) {
:Sk6Jdc3Sby          document.all("supertext").style.left = xPos + document.body.scrollLeft;
+l:`w^6Z$g,h?          document.all("supertext").style.top = yPos + document.body.scrollTop;Kzx$|6v_ e6]'Lt8f(f
         }
qo$@Oh2C       else if (document.layers) {Z0}5]:CJ
         document.layers["supertext"].left = xPos + pageXOffset;
[Qy&cF@;mQM5\          document.layers["supertext"].top = yPos + pageYOffset;ysq.y^.VD
         }
&Lb3~UV8dU       animatetext=setTimeout('moveBall()',20);
(F]RCn~+ITL       }^~oU@Q@:]
   }U#g\Lt gE
'Rnd#oW:[\
function calculatePosition() {qML oLt#tux
   if (xDir == "right") {
'U_\uyV]       if (xPos > (xMax - contentWidth - BallSpeed)) {
EBop L          xDir = "left";
S;] f"?5l$Dt          }
g2C"`?h,c[ \       }8k j#kb F4DAm
   else if (xDir == "left") { B'BX.^:B]x/`
      if (xPos < (0 + BallSpeed)) {
/K7V7\+v.F          xDir = "right"; l-|1J9vkm*|
         } mH#v w n2_B
      }*k5o#b \Th!hhF
   if (yDir == "down") {utLON/k,e'N4p
      if (yPos > (yMax - contentHeight - BallSpeed)) {
\(Y$cy;Iw%g%_          yDir = "up"; j,e\7Y#Q|Oac
         }
)E2O#\4rT:U.f       }XQ O^*n6C
   else if (yDir == "up") {jG'u5n-? K}0XM
      if (yPos < (0 + BallSpeed)) {
#s)Y-|Y*s"\"t          yDir = "down"; O,bXtHh!f'B-S
         }9P G(Q5f A#^%_
      }-n6y(_B"O-Q"O6o
   if (xDir == "right") {
A%U ~h!o(N@       xPos = xPos + BallSpeed;q2Z+|W6Qk4Vm
      }
5Yho%AKB.V }    else if (xDir == "left") {
*X8df3| r8iU       xPos = xPos - BallSpeed;
@W{*yo5Gi W{       }
2n)gD ~$a{s    else {
wK$s4ah}7o-F       xPos = xPos;#oGh%u(} Qp\:~!K
      }
fG!o3KLR"f&w    if (yDir == "down") {
V _@&z;csS+sbb       yPos = yPos + BallSpeed;$Q P(B-debgA'R
      }3FC1Q0PU7k r
   else if (yDir == "up") {
As-U@,M`M       yPos = yPos - BallSpeed;%e'o"TO_`Q0U
      }F3Ap^Yu {s
   else {
.uU$@F V%M\       yPos = yPos;
a!L-Do%q"H \j       }A\_ Ww3Z
   }^j?'P [!V |
Q q1X E x(?\c
function hidetext(){.G s {_MBp%d
if (document.all)
C0z,PqhQ} LZ supertext.style.visibility="hidden"F4j? T7rc F
else if (document.layers)
h Q6z+_tLh$t document.supertext.visibility="hide"
?x"?&y5|Y~w clearTimeout(animatetext)Q @5X!]6uS'Y
}:I"?@3J(tie

M3x#Ts.p&Wi LxM if (document.all||document.layers){3bFaQ/mI E#A[q_
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')'P%u/O4?y6@8Y
window.onload = initializeBall;$HeA4V3F|C
window.onresize = new Function("window.location.reload()");dy9PW.jgP"o&N
}
R6]\eK
ykA/Xie:V </script>

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


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