捌玖网络工作室's Archiver

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

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

<style type="text/css"> Ue#FH.c%\(OI6OF
#supertext {-Y4N lzk|
position:absolute;Vhv7i G$^H8d
left:0;[L3qA8a2T1T
top:0;t-@-^)I9\&P7ZEG-M
visibility:hide;
H4Gg&js+}fBf \d visibility:hidden;
p0sc#o x }sf*^*r9cu4g
</style>
*`g q*a En5]*Y <script language="JavaScript1.2">
)uFp!S~-nk:_ <!-- 改变下的字体的大小。颜色-->
t%sUf%XFz var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'AS$od#fg*t
var hidetimer='';n6h k Jbc-D8M
<!-- 改变下的弹跳速度-->X%FC0h TKA
var BallSpeed = 20;7Q/v6[[b3Fl
var contentWidth;%e5R [G4~He5Uh
var contentHeight;
eAL5V cn:X7t7Q var maxBallSpeed = 50;
.`m m*\t1ImP )KU \L?i
? kC8z9o'n X
var xMax;
0a bY`"?C?|P var yMax;_8`1O)w,J;{9A4o
var xPos = 0;
z5~$_:h.p7^ var yPos = 0;{4O;B l&zY2b!|[#^6vs
var xDir = 'right';
:{+b8C)B.N] a{ var yDir = 'down';N2Y,PXEwh
var superballRunning = true;
/lT P5AHY@ var tempBallSpeed;R8V@9T |6u
var currentBallSrc;~`0c(ULf I1i
var newXDir;]m!|6_8P?5Z&l
var newYDir;
.le0V'T6Jg0R#g
)l@1LA1Q,XR-A{ function initializeBall() {~Wl8ub,tQ
   if (document.all) {
_f&T,M2oY3|       xMax = document.body.clientWidth
tK4|&i"j0|w8m4E       yMax = document.body.clientHeightcl6Aq'\-?b@8C
      document.all("supertext").style.visibility = "visible";
#vJ2?#qW1X       contentWidth=supertext.offsetWidthHb1V$z jXY _2_@
      contentHeight=supertext.offsetHeight9sI&tb9bD
      }
%W BM:Usj4X    else if (document.layers) {8h~U9s3? sKU
      xMax = window.innerWidth;
`.p,R @#n~;j-S       yMax = window.innerHeight;}5~#HM{t ]5K n
      contentWidth=document.supertext.document.width%m_'SS sT+}5^i
      contentHeight=document.supertext.document.heightmkD1iI}G|
      document.layers["supertext"].visibility = "show";,XN%uy:n%L D4L
      }
2b8EKC5B$O#v    setTimeout('moveBall()',400);
2_1N:QE4J*W    if (hidetimer!='')
\;e:R(eQ    setTimeout("hidetext()",hidetimer)?u9?N7f
   } Liq3s0T&z
E;u} d)X'T;ZgSJ Y N m
function moveBall() {%p_ lp3[%a)X r3}
   if (superballRunning == true) {
l l:_gx       calculatePosition();
1tW5~.B] hs       if (document.all) {
$go{#qYU7H]8B          document.all("supertext").style.left = xPos + document.body.scrollLeft;
^9Aj5{9[y1?M          document.all("supertext").style.top = yPos + document.body.scrollTop;
a5eRM1\ p.w GQ          }
rH(I2a+\ ej,GnRy       else if (document.layers) {
%h;@N&jX+J9P          document.layers["supertext"].left = xPos + pageXOffset;&V)o |!t6hjX
         document.layers["supertext"].top = yPos + pageYOffset;`q| xtN
         }Fmd{4y
      animatetext=setTimeout('moveBall()',20);W,{ R#t5j)bV;aa
      }
Gn F'R+_?%e    }
2iEg1s^{+q3v 9h3e*^5JW X| g
function calculatePosition() {
OR&f;Nq_7N    if (xDir == "right") {
8f!}Oa,F       if (xPos > (xMax - contentWidth - BallSpeed)) {
K7|/XnyK          xDir = "left";
z'dCy9{LP          }{g[n4hG
      }
QGGM$Cd4\    else if (xDir == "left") {
a mk;m5V D,I!QF+U       if (xPos < (0 + BallSpeed)) {
pW|r0A!xt          xDir = "right";Z7j Kp:oX0Zn Y
         }
A+Ps%sO^W;e Y       }
o6B9u0e2C/AmJ    if (yDir == "down") {
} X0V{t)W-V4a       if (yPos > (yMax - contentHeight - BallSpeed)) {Aa!gq4zS!Nz
         yDir = "up";A }(c(b9O[;Pa
         }
U ny'^yZ       }2@?%gCb'w!mOk)g\c
   else if (yDir == "up") {3?RA)B+Y
      if (yPos < (0 + BallSpeed)) {q7@ y@1^ i%d!S
         yDir = "down";
%qR/K0o"o \1[,~Cf          }0BFvHy ] q v:s
      }
Q/^3} OgP    if (xDir == "right") {i t-] j `6cIa
      xPos = xPos + BallSpeed;
(Z-a |#V6D1}       }.t9ml4k ie,QIl4h
   else if (xDir == "left") {
$@|n]t       xPos = xPos - BallSpeed;
#@7ef,[mkH6nTi       }8C2R%@ [,a-a&u
   else {4aJ,n$N C h:`0P F~
      xPos = xPos;|)@}U{ x!M0r3q2Q0h {
      }Ox+E&i$s9l2O+D zx
   if (yDir == "down") {Ey-G/g'K#h{lWA
      yPos = yPos + BallSpeed;QB \k _$[
      }_&v i(i X @nl!jd+L
   else if (yDir == "up") {*x @ U,kt,s6C
      yPos = yPos - BallSpeed;vbDK(aI^3[
      }
;Z Mq2ZA Do    else {
GT2a:~-m vEr/r"d       yPos = yPos;
(O(S6P6} k V/C`o       }V uS }mD/JVB,h
   }
F _S v.W*AME
W ]_S-b(J function hidetext(){
l8\ ye%pp o*b8}(o if (document.all)$T2UvN ER
supertext.style.visibility="hidden"
E AQ d p/D'h.~ else if (document.layers)
`|C"e yxW#O4{5R document.supertext.visibility="hide"
i.n$R,|&i:b clearTimeout(animatetext)
cbW7A!U R }
G+z#iW"K*Kx{ i+uNd*R7Sj
if (document.all||document.layers){&aE ~.Cv|
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
\ h[;y Q!G;f+P7o window.onload = initializeBall;4qC3['H2V
window.onresize = new Function("window.location.reload()");e TE+NU
}
+U0c4Y&x4@w!Y
\K)_ G7s?#F3rm*j%O </script>

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


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