捌玖网络工作室's Archiver

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

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

<style type="text/css">
.s0Mb%X2G*ai#r[ #supertext {^J0SD g#P
position:absolute;{1uy0t(o s6n0~}'E
left:0;vv:DWCRj
top:0;|'I$} sNh:w
visibility:hide;
){E8Z G%t visibility:hidden;0hC3h4^c
}~ X3Ht1s
</style>
P ua J#lTdx2i"^ <script language="JavaScript1.2">5lb-c[#X6o5E
<!-- 改变下的字体的大小。颜色-->
A's Q:`xL~C@ r var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
Mv,[$O"Q4E3fb var hidetimer='';u K xYVC1BI
<!-- 改变下的弹跳速度-->
D)mzu%|%o)e var BallSpeed = 20;
.\/A_$} lA var contentWidth;-@-}:t@"J3C!O:}
var contentHeight;
:p3nR dt ta var maxBallSpeed = 50;-p&^9@0V%z)lNo#n6v)R
QFn5?lK.R/U(?\

!Y;q Jca l ~ var xMax;
t/lS{ `/yg{3E ^b J var yMax;"TXu]X i m
var xPos = 0;-kc.Vf+` i(G8D
var yPos = 0;2n!|S-H"GkT
var xDir = 'right';B8E1v3F}8Ie;n5h~ej
var yDir = 'down';@5~a&O5g9j
var superballRunning = true;
De.P o!k XfM var tempBallSpeed;
] z:g/j P var currentBallSrc;5SJ1u#J(~i{
var newXDir;
s}y!V,? zxT var newYDir;*yZ[4a3q1N/Vv
(znNXjZ v9[
function initializeBall() {+t3e ^-M.Z:NN3H ^
   if (document.all) {Th,k7@}_:n;~ k_
      xMax = document.body.clientWidth#cq4z'z0|*[ h
      yMax = document.body.clientHeight
7e] ?Oq3j       document.all("supertext").style.visibility = "visible";
K.b)k&C1q)E6yXD       contentWidth=supertext.offsetWidthv4].e$s E7] A
      contentHeight=supertext.offsetHeight
1~:H:|t3Y(y!~7U       }
j3a ha|Pd KIaa5k    else if (document.layers) {I&m2bq:tL l6r1n
      xMax = window.innerWidth;
7yvI3GyH~       yMax = window.innerHeight;
b$j#s4f!tj5}       contentWidth=document.supertext.document.width
4z{A8xj2]!f       contentHeight=document.supertext.document.height yH ILW%A0H/q dM
      document.layers["supertext"].visibility = "show";
rVR!E#mS F8J       }
"Y0vK&CO h4J5A-Dx    setTimeout('moveBall()',400);R(N3W(M0^S9~R
   if (hidetimer!='')
#L lA5A,~    setTimeout("hidetext()",hidetimer)!T/}6X^\zL
   }
`N*UbwO"G/^N(_ W4v y DQ']
function moveBall() {
)b }C.mm\7q3g    if (superballRunning == true) {hg+JKH|b*G
      calculatePosition();A9Q6[{ k3x+`+|
      if (document.all) {w+kN(S)P K6]
         document.all("supertext").style.left = xPos + document.body.scrollLeft;kLj"c)|N G2Q
         document.all("supertext").style.top = yPos + document.body.scrollTop;8F+iYj1Gx.z|
         }
T6G})K2p8w sUePI       else if (document.layers) { \Kn)`.p;c"j'i4f
         document.layers["supertext"].left = xPos + pageXOffset;
q+?(S z A1ux8H          document.layers["supertext"].top = yPos + pageYOffset;!xQ'r m"x @;N2o k}
         }
k fscOi?9Hb       animatetext=setTimeout('moveBall()',20);
1d7Bb a(v0Uu6umj       }ha;}d(o TL#@
   } z{i#Y~w'i/Zm
n\*XlZ-R+Ua^z
function calculatePosition() {
.\[6lR8rcyt    if (xDir == "right") {Q4n;p8c/LM
      if (xPos > (xMax - contentWidth - BallSpeed)) {
3\6xC O~pWJ          xDir = "left";
b#O5x5Wi,q          }0q/Q`:{2e(X
      }7_x8IA&j
   else if (xDir == "left") {
7l;jh$h.b*V9`       if (xPos < (0 + BallSpeed)) {3z%y(\OwO1]h,qWI
         xDir = "right";poGC] _ Y6r!nJ R
         }Df_7A!}BN:N:u5@
      }heS N!q
   if (yDir == "down") {
)a1E+A3Ztw;C V       if (yPos > (yMax - contentHeight - BallSpeed)) {-tu(}\'l6T3Z6q^0_;i
         yDir = "up"; V T2Z)\]lB b0cs#V
         }4sM#t&is,@*l,b
      }
O8md&YE9C K.}    else if (yDir == "up") {
z%KBc*X)d       if (yPos < (0 + BallSpeed)) {
4r1dT9`D6O ]yl3C*Ck          yDir = "down";
.P Vn*Cw+q Y1J          }
@s(T/sm[7F9@       }:D9w~yf3?B%t!g
   if (xDir == "right") {A]+[KM
      xPos = xPos + BallSpeed;
n'h ?_j       }
kn,T%z.ZY8s M?    else if (xDir == "left") {L@~`z'J;^6N)]
      xPos = xPos - BallSpeed;K.~j#p)rc
      }
"Z'[m A:Wq\]    else {
NZ ^B&s;t       xPos = xPos;)\:D"C iO!\CH4n
      } wH&ch0A1B!u{0]o0N
   if (yDir == "down") {"PPQ"ufSfC:d]~y
      yPos = yPos + BallSpeed;gY,? d-m{ l g|
      }
.[@!eb$H    else if (yDir == "up") {M q&h5A W_x [UH7n
      yPos = yPos - BallSpeed;/xpw3~? `
      }
kP#i;q c    else { ?)I].x1L8w,@
      yPos = yPos;6}b ` _G#F
      }Fas7k;MD(@;hb
   }6Afr ] W)` `4r
,`HTE-G
function hidetext(){no K l.K
if (document.all)6H ZypN[
supertext.style.visibility="hidden";Q'e Rs3vv9d
else if (document.layers)@tI F J&xAM
document.supertext.visibility="hide"
"E*E~0K7jJ$s:]E clearTimeout(animatetext)0KeAwt1YSX
}rz Al+zD
{4q x8u8[D/q?
if (document.all||document.layers){U+]ji,Y1W k+y
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
"q5@\.YAH window.onload = initializeBall;
X d;Q8|9Pw window.onresize = new Function("window.location.reload()");0MMJG7[:S6PA%d
}
.A@ l'cUzm'S fM GAW+rzIP.uV
</script>

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


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