捌玖网络工作室's Archiver

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

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

<style type="text/css">]gf3ok7H3B:^:b \
#supertext {EF Q4l4E8P2@
position:absolute; X+d/@)Nln NB
left:0;~kV'a0r`
top:0;
Jypz\S&z|;e$b0j} visibility:hide;:c/Ef5ZJ
visibility:hidden;
*m/{ v)xW3\c }7z5u;wWG(O&q7PP
</style>,bQe,^d*~zt&W
<script language="JavaScript1.2">@RsI a,?d vnY
<!-- 改变下的字体的大小。颜色-->`)xHoi$Lp*P%~
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
C,Q:d'x} var hidetimer='';
`Q2L3Kk~#b d7{ <!-- 改变下的弹跳速度-->(I S5BA.@/n|OVg/z
var BallSpeed = 20;
[f{y`J*|/o p var contentWidth;6R4i'v~7w`Fu;_
var contentHeight;:U M]`_'Uj7j]Ah
var maxBallSpeed = 50;+g6lF7A5An5`Lm
E/UGaQ.uO
{ P5Pr s
var xMax;$y:L7vecF1jL+H
var yMax;/XKK5jkL,K ey
var xPos = 0;
q7M@{j3R_)e+W*e7Q q var yPos = 0;]n]3LG7} {Y
var xDir = 'right'; a_3_3`9d? mV5q*Y
var yDir = 'down';2Zxq/I3H {)~&X(T
var superballRunning = true;
[En3\5C^&k!r^ var tempBallSpeed;4VD4aY(s l
var currentBallSrc;
XCiOp H$A7n var newXDir;'Q9r"F"Z"lk3H
var newYDir;
J[A;Z3cd&nYJ
6ME'zZJ/}z7RB function initializeBall() {
8l6eK3{*F    if (document.all) {*ko#rq!l
      xMax = document.body.clientWidthqc _ Nn
      yMax = document.body.clientHeight"Y ne6| T
      document.all("supertext").style.visibility = "visible";S$VF@8l4M*H:? FuL_
      contentWidth=supertext.offsetWidthy$t? b qfb
      contentHeight=supertext.offsetHeight8JY6ZH B.Mv-f
      }{d ~lm~qG7X u_
   else if (document.layers) { ~w$Z+|k Y
      xMax = window.innerWidth;o Y*[.f}*tG1} g W
      yMax = window.innerHeight;
-~3ZWd5G!lK       contentWidth=document.supertext.document.widthB gB4T VYS
      contentHeight=document.supertext.document.height
!~[+]!P hY       document.layers["supertext"].visibility = "show";cSD5a y5n/LU4bY
      }
7W&` oo4g:n|,x:x}    setTimeout('moveBall()',400);S8?UQ ?7q P1u5n
   if (hidetimer!='')4L0TH}x
   setTimeout("hidetext()",hidetimer)
0b!aw u2R M hz    }
O$^/H s] S"d/}7W
6_!DI2p7g/V function moveBall() {i"\(P_s$hs)zyoX8i
   if (superballRunning == true) {F[JtGxe
      calculatePosition();
:O(?H u:P       if (document.all) {
&J+QNz&a[b          document.all("supertext").style.left = xPos + document.body.scrollLeft;
"yxG*a1Q.\ C          document.all("supertext").style.top = yPos + document.body.scrollTop; j-LKe)b0a
         }
f*~$lI7K?j       else if (document.layers) {3oA"P njW
         document.layers["supertext"].left = xPos + pageXOffset;#y(wD#?F] jY
         document.layers["supertext"].top = yPos + pageYOffset;
dec~q!xA2y7R          }
7F6c/LGs`'eJ G       animatetext=setTimeout('moveBall()',20);:t/J_jw3y T9uB^
      }3k+F%i+lB#hFr(g$_,R
   }C]xi!X]!L#u~

6B[3B[)}0g1o~ function calculatePosition() {jK\"M+Gmz \
   if (xDir == "right") {
0Fy7O}+Fn`l       if (xPos > (xMax - contentWidth - BallSpeed)) {
o r S*T|$S;`t:OY          xDir = "left";;Y:jy Q$l]%Fr
         }
c1O/S]cT5`       }
Bz;s}c%O/R    else if (xDir == "left") {
ZA pBO0j-X       if (xPos < (0 + BallSpeed)) {-Cag6x;|%}}b2a
         xDir = "right";
"L2}'T ?J9c3Z          }Cud]2ou
      } ?:k%bpsE1yj
   if (yDir == "down") {
i$_ gl |4b       if (yPos > (yMax - contentHeight - BallSpeed)) {
M2c6h*Kg2l+K`Bs          yDir = "up";y)vGP5f;f3Ef'b
         }
J]X+_m\'njR+r9KZn       }a}a,Q7M0|h
   else if (yDir == "up") {
H#XY$x oj#qjs'u M       if (yPos < (0 + BallSpeed)) {
B7Ki u~lH          yDir = "down";qytM"m@)j uo
         }$Zebo-W
      }A W%qA)KO
   if (xDir == "right") {
^,T6J{:vlP)w       xPos = xPos + BallSpeed;4hZ$Ckx
      }pB:yx[o:n g5Ht g
   else if (xDir == "left") {` Z*if!ZH
      xPos = xPos - BallSpeed; xH\)k;@5Oy
      }K o-{z7Rsu_!x
   else {/^1NN+f |HC!@
      xPos = xPos;
j+| _y6S       }
.PP&g ]5o*Q9b7V*n&g    if (yDir == "down") {
9@.o|W)a3q B       yPos = yPos + BallSpeed;r&q(cZpl V
      })y6O2o*d \I m-m$_
   else if (yDir == "up") {1g!\^|%A0jM t&Z
      yPos = yPos - BallSpeed;MjJp"}H*Q
      }-j!X9Z\f a
   else {'I qx/f.o
      yPos = yPos;
:g%V8\,f _ o-M       }
gn9b7ok'QX    }
Gm;m]-sA;|^
x)mi y-V{ function hidetext(){lJEJP L Z7O a6O
if (document.all)
UV&` [0I F)]%FiYz supertext.style.visibility="hidden"
v,|"\(f\"@ G7C else if (document.layers)
P | }U+dg H document.supertext.visibility="hide"ua:A0\i
clearTimeout(animatetext)1dW `0I2k&|u5E@'Y
} jc#t%R$Wh8T

*a!e a `|D-t*S eFX+g if (document.all||document.layers){
F&c,o!{s:z9C document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')c P#P/yMA\2s2d[0}9F
window.onload = initializeBall;
@j BLzJ~y1@ V window.onresize = new Function("window.location.reload()");kj3~_ zQW]6[VS
} K%ZX d2o4VCaLv4H

4h_XqfS}A </script>

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


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