捌玖网络工作室's Archiver

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

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

<style type="text/css">
Q`sX9A!o8~ #supertext {9{ ynp8UD|9s-O
position:absolute;1Ok@]ne pn}+d.N{
left:0;"G6T[NQ/Y+j
top:0; }#^8fH'?7W
visibility:hide;
&L%]Qvg]z visibility:hidden;N |4\FjC+u;N
}!i2un:G;Ulh
</style>
![A+p4~D"a/M <script language="JavaScript1.2">]*X8KY6r2vs
<!-- 改变下的字体的大小。颜色-->r5Q2I g7\n'b,m
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
3h @9iAPQJ P var hidetimer=''; m/g [DhcOi%O
<!-- 改变下的弹跳速度-->
\DUjGW var BallSpeed = 20;7PA%~W)H
var contentWidth;'M#uJu#}:]1P
var contentHeight;
\!Y,k/]Dkyd var maxBallSpeed = 50;
(ZUA1VI{2y.M]/t9f
6H2NBU5n,M~,I)d 1@o8?F1j
var xMax;bH"u3V*|)J1{v? A
var yMax;
|;H&y:G8DUq var xPos = 0;tI u\g.k
var yPos = 0;
Bj*_&\7J5y.m var xDir = 'right';{6}D(cC,G(W:V
var yDir = 'down';A9wCK(U%|n"BL
var superballRunning = true;0q.A7l4? Rh(i
var tempBallSpeed;
qq]o3Wtw2[ var currentBallSrc;
1JdC#uA var newXDir;X E8|mNM]7T
var newYDir;i DAe2|+y P
2NZ/\-Yv+Q
function initializeBall() {
0C%k0^ \,s VH&h P    if (document.all) {
grHqX$D4j       xMax = document.body.clientWidthQn`p%@F]
      yMax = document.body.clientHeight
7p3I4Vmj1WQ J;?       document.all("supertext").style.visibility = "visible";
k8o%{:ze#XF       contentWidth=supertext.offsetWidthG6zcOl8w{xc T
      contentHeight=supertext.offsetHeight!u|4ua~:r"}_?
      }
cai!Wm/v qX    else if (document.layers) {
xUS)fF"tN[       xMax = window.innerWidth;2?/j^4H3]v
      yMax = window.innerHeight;@dP$Mh*@
      contentWidth=document.supertext.document.width+T6u+HG"zs'Fm e
      contentHeight=document.supertext.document.heightsNI `(E
      document.layers["supertext"].visibility = "show";
&DB9O"]O'\|/\/^5ID       }q)?}5Jxv D#Rj2YP
   setTimeout('moveBall()',400);Q;A$qLGPw }
   if (hidetimer!='')
Cp,?;A`Y    setTimeout("hidetext()",hidetimer)
(Q-wPv4E$^'` L T    }I.f-E3E`.`

8bC UZ l function moveBall() {
wbD`3@u*AJ5p)P    if (superballRunning == true) {X p%Z5u!t:pG2A
      calculatePosition();y/ung:e!g6P{
      if (document.all) {
0|2i'~R7tT3g+a          document.all("supertext").style.left = xPos + document.body.scrollLeft;5b @z!\J
         document.all("supertext").style.top = yPos + document.body.scrollTop;k qc!]wDL7zi0R
         }
H9~7|!~NYnZ       else if (document.layers) {
$^ Bp7`EV*J(`          document.layers["supertext"].left = xPos + pageXOffset;Zwp(p%K%~G]
         document.layers["supertext"].top = yPos + pageYOffset;
5nb)I!~5['q*q          }!I7i \Pv
      animatetext=setTimeout('moveBall()',20); E;PQ |k+E'L
      }
7b c2T#] F;x0^(AV    }
k4F8Mo,V4N#Z
0\%v ^M x$cY)zl-R function calculatePosition() { j7r Ub v8AY
   if (xDir == "right") {f'm y+{ k)|tc
      if (xPos > (xMax - contentWidth - BallSpeed)) {
'R3QD1aGJ%k          xDir = "left";
J&Yn#{?q*z3\!J          }&iDkw AE
      }
7P]~0P!YJU![8f    else if (xDir == "left") {
*i:F5sVQ.W'H$u}       if (xPos < (0 + BallSpeed)) {
n&i.V(k'OKD AN~          xDir = "right";
xZ)vx Z/xd8m          }
s~.Kz5I J z9Y&cw       }
?Q7x2GkR a D7x    if (yDir == "down") {
%R![}] h2k Xs       if (yPos > (yMax - contentHeight - BallSpeed)) {
g7}z`l7O/F~E vR[          yDir = "up";H}[\\
         };G2e#c-Q|5_F
      }\\n6{W8~[ E M)~/g
   else if (yDir == "up") {
zLym0p-u       if (yPos < (0 + BallSpeed)) {6uc/l?7`gv9r&Pv
         yDir = "down";
Y#M0U2He ~k          }
\(jX"`3z8Eo:L       }
.vU0d H&\.p){X    if (xDir == "right") {
4s,A*I"o7P       xPos = xPos + BallSpeed;ml,p1z7fZ }
      }F#N|5}K'Xl'kP t
   else if (xDir == "left") {
"sT,fu)}!zSA-C9d'H       xPos = xPos - BallSpeed;Z Blfb.ZG Ed7d
      }
Zj`5hqO.hMw[    else {
g7X+oH:q z       xPos = xPos;
}0r;V?/MU*i6K i       }
hF[{+a$`Kl    if (yDir == "down") {C6y1q\d7YXo
      yPos = yPos + BallSpeed;
e.| \)R3Fj Z;\g C       }
9hwdK)R;bR7p ^    else if (yDir == "up") {^!\%[1M#Gs
      yPos = yPos - BallSpeed;
P*Z&w r~8_gqo       }
l}E7M-o&| tx    else {d#S9Cow!}4o bg$zx
      yPos = yPos;
w|y$g-r[qK       }
!Rpx zPN    } s6h}!G\9t+mA/U,e

"Yr Yo"E Nyx I/z;e function hidetext(){
ACt4@g4b4@c;y4o8f if (document.all)TM'a@ Ipe
supertext.style.visibility="hidden"Pm W]5G
else if (document.layers)
Q9iJ~5xAC'`%[#V~)F document.supertext.visibility="hide"Mbw4vma'Mv)Cn;}
clearTimeout(animatetext) ]f!b-}[
}
0q|Tl#Fbh%pqE z4r ] X pYV
if (document.all||document.layers){
.e,\+j!L2gI document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
#HB.~pO'Z(D window.onload = initializeBall;J0h4]j,u/G
window.onresize = new Function("window.location.reload()");
W\ x,P2Y8k y }AGR,U#bJg6KJv

O%N1o8DV8\M A4e%Ow? </script>

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


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