捌玖网络工作室's Archiver

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

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

<style type="text/css">+kT)mdR%[e
#supertext {
G^&_1D;K#X position:absolute;
&eO5^U2E?gpg1f left:0;FH b K)}Ng}R%P$z
top:0;A,O8U(F3qd\wf
visibility:hide;M ^+]:mgr
visibility:hidden;*a"yP:W~St X
}
ptfD;B1nb </style>
Zs-T`i+D'dr <script language="JavaScript1.2">
?S]4W jfK4TQ"L <!-- 改变下的字体的大小。颜色-->9Z2aNm)S zBQV5l o
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
b [3e5N}R u*R var hidetimer='';9\c~5L3hP%d0|p sC
<!-- 改变下的弹跳速度-->,I/_:W tZ7F3D
var BallSpeed = 20;
dF!x,E,^E Z o:~ var contentWidth;
n2S*hu?m$Pee%nB var contentHeight;
Vj'U{ Kh)hQ var maxBallSpeed = 50;+wM:k/uyOU

?#K[-tO
yy fx"x){ var xMax;.g w*k8gD3if
var yMax;5oDno|6k6S
var xPos = 0;
1w { r"EF5D8x var yPos = 0;2um{c+M7i
var xDir = 'right';
+yq8~|:b var yDir = 'down';{i p,z9TuH
var superballRunning = true; I e[Q ]Dh[Q
var tempBallSpeed;
z&s;~b$w var currentBallSrc;
j7l8i$E-LA var newXDir;A0W9W;R0yo
var newYDir;
1LR2NW&^2`5n\F7z
/}.{Bq Q~S function initializeBall() {(EUu#aA%ZE0|9U
   if (document.all) {DGt P9m*J'i4w
      xMax = document.body.clientWidth,V%Y \/UPk/}#O
      yMax = document.body.clientHeight
_`L2\Nxn/\       document.all("supertext").style.visibility = "visible";
DE:g"K0j/i:Ku       contentWidth=supertext.offsetWidth
7E)lml:Ssw       contentHeight=supertext.offsetHeight
Ziv+R[X2HS OY       }
'QQ,G p6u|9v4Q    else if (document.layers) {I#Dv*gUk3}
      xMax = window.innerWidth;
z9vs2zg {FY"W       yMax = window.innerHeight;
M5L$L tV@%s;e J       contentWidth=document.supertext.document.width
R7[L@%w       contentHeight=document.supertext.document.height
H*]7h6cU2cUa9B'GK       document.layers["supertext"].visibility = "show";
8c]`~3[n4J       }
A.XT%U/E*V~7_V    setTimeout('moveBall()',400);
m[Yw^${`    if (hidetimer!='')
V.kS&qE5a$xn'Z4r0P9U    setTimeout("hidetext()",hidetimer)7oDDf-I.Rc
   }0gtU^[ hAN$k
/iuN t\|`J
function moveBall() { R&S0|*~ N7Z"C3TE3zr
   if (superballRunning == true) {/YUT"p3`!G\
      calculatePosition();$wkW QG;i
      if (document.all) {
2@t&H$}9s;P-H/g          document.all("supertext").style.left = xPos + document.body.scrollLeft;
UxE#JV*Z          document.all("supertext").style.top = yPos + document.body.scrollTop;Y:d7Tx ^`:f
         }
I*nFl6c-dG       else if (document.layers) {3v5OHn O2M%MK'A*y
         document.layers["supertext"].left = xPos + pageXOffset;
||i%` Bs&Z,H3w          document.layers["supertext"].top = yPos + pageYOffset;:g3x;d j7tc O4L
         }
SC8T$O6o9B}       animatetext=setTimeout('moveBall()',20);
#H/u(Ah}[ z7~:@ o&e       }
+i%Okm4q-Rr    }xK"m*J6\/V?H NW I

}9QV+r.`NM `^ function calculatePosition() {
tXrie @    if (xDir == "right") {
G6_cWtm       if (xPos > (xMax - contentWidth - BallSpeed)) {d!T"{ N7[K
         xDir = "left"; mO"r L Daf;t
         }
{GH(W$l@"Opg S$L       }5Is;puWG8Y9e3|
   else if (xDir == "left") {6x(K6p"~ Tj$N:f
      if (xPos < (0 + BallSpeed)) {{)UBVu/q
         xDir = "right";2E!v^2`*g0n:z;c%|d
         }h2pr@ww.uF1k
      }T\&sWH-v1~{n
   if (yDir == "down") {4| _+Y5|h:|
      if (yPos > (yMax - contentHeight - BallSpeed)) {,[iU9C!e3H"?W
         yDir = "up";`/^O6r ~h1a
         } vU6nG^FrU
      }
|&A.uU?1~C~    else if (yDir == "up") {
x,BL5c#r tT       if (yPos < (0 + BallSpeed)) {%[r @#Y3C
         yDir = "down";
l1w0G2H(y0h          }_q7u)T }S B-g
      }^za1m}v
   if (xDir == "right") {
S!xd0sh_vx0|[       xPos = xPos + BallSpeed;
)C2J}N2a#W       }
q@7Zesi1lrY    else if (xDir == "left") {mA/c+{'T#|(?8SBT
      xPos = xPos - BallSpeed;u&Jf5b _ @ J K(Dj
      }U)ie5|c(m @
   else {#LNi1H8P {#y
      xPos = xPos;
t-L XCdk@v~c       }
*?f$jMjtA(z    if (yDir == "down") {
r:aS&D{5T       yPos = yPos + BallSpeed;C x$G8{8}5p p
      }JBA9L5|R7Ibz
   else if (yDir == "up") {i.h)l"K4o/S
      yPos = yPos - BallSpeed;)G([j {+z`Ga0UM
      }N:Q+v+G_AV M
   else {;{IP7cJ8wYV/O0cD
      yPos = yPos;O`6c ?5H~V
      }3G:w%VK1cXCYf
   } S-DM T;oD
2O/lN ^W y\'cA
function hidetext(){3O-u2S XZ,U2XBs
if (document.all)~ z"`nA6_Uk
supertext.style.visibility="hidden";YTlK8pb&xPv
else if (document.layers)F;lv+\4f_ @1n
document.supertext.visibility="hide"4euQL7A
clearTimeout(animatetext)
1gl!lU],Z } o gQur+gA [

H(Zc*ZTM)Pt if (document.all||document.layers){EB_Y[
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')z*_3w}8{&H
window.onload = initializeBall;;`S6dh Lcz
window.onresize = new Function("window.location.reload()");
vo-K_SOg })v5^[ AQN\

2m`-SO)r,z </script>

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


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