捌玖网络工作室's Archiver

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

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

<style type="text/css">
WD+_y2fn,TN #supertext {Zkx{(`f
position:absolute;5qR z$V;r[
left:0;
I*\ x)w)[3o:dDB top:0;
a(SZ.T4g visibility:hide;
p)d1cu.in p {u visibility:hidden;fAW fok]"M
}
S!w8`Z| </style>
,W%@Ft9t <script language="JavaScript1.2">
_5o8A:zF4wrp-U!g <!-- 改变下的字体的大小。颜色-->
1Wwf y,I+K&}/Z2] var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
z_(^m5Xs&y.Xg var hidetimer='';z zcVDeN&KD:F/ri
<!-- 改变下的弹跳速度-->Mr6~3d!s!I2v
var BallSpeed = 20;
\B6KA Wx:| l#D3E var contentWidth;
x@j-w*gDT\ Rp-Qy var contentHeight;/J!\-u0U(V~
var maxBallSpeed = 50; GP&iOEm

Q:Ol ]0`)~Q0^ \7BXqy}I9f)G"V
var xMax;
B$vL k:N var yMax;
,G%K M3qH~&eS KB e var xPos = 0;ug/r q_%cx
var yPos = 0; swaO#r |E\p
var xDir = 'right';
3S9q6eRZ(P_ var yDir = 'down';
'W|7O:M Kb Qm var superballRunning = true;#Y,v m"@MCz j
var tempBallSpeed;
d%[3r9eyB3RI var currentBallSrc;
;U3ks%h!I.X.C0a&Q var newXDir;lj6xb|j/m
var newYDir;
'S/q:P P4b"M
GE.ZT ]2H function initializeBall() {FaY6gs;`
   if (document.all) {q X1CTQ'B
      xMax = document.body.clientWidth
/}*Lm lQ8wc C       yMax = document.body.clientHeight
)z8H7|(DD].m\       document.all("supertext").style.visibility = "visible";id8S8[ GWL!SGn.dJ
      contentWidth=supertext.offsetWidth-Sz dqJx tV
      contentHeight=supertext.offsetHeight
M(bJ}R(O/B-vTo       }
{0x8r t\)}    else if (document.layers) {u3N gc'u1B@
      xMax = window.innerWidth;v$a UtV3J#b6Wx
      yMax = window.innerHeight;
|'U`$^Z-a       contentWidth=document.supertext.document.width
7a3rKkPc H       contentHeight=document.supertext.document.height9V-tfv8NHsT:I
      document.layers["supertext"].visibility = "show";
1]N5|-x!@       }m!S Yo6iCU"M
   setTimeout('moveBall()',400);
![T'`e {5K    if (hidetimer!='')
wFr![)i?I,a1d;I7^;v    setTimeout("hidetext()",hidetimer)
UY$A,A+J$kp    }I9[XR:|A1dA

v%ka'u+F:e function moveBall() {
/im/j.x~pF0ho    if (superballRunning == true) {
0Iz3B+Q K4Bm+gi       calculatePosition();
{YT |I ED~       if (document.all) {E$F kl*}9dY/k"s
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
.tF,[uW;K6g[0K,^          document.all("supertext").style.top = yPos + document.body.scrollTop;\-P R%]G#S&S
         }a{+V,c@t
      else if (document.layers) {-ec6k#` L
         document.layers["supertext"].left = xPos + pageXOffset;U F7m\)@FA Zfz6q
         document.layers["supertext"].top = yPos + pageYOffset;!w3\.LRk4B
         }Jy$QGL `k
      animatetext=setTimeout('moveBall()',20);0t @&@:iQ,_BQ#k r{
      }
G!?4ZdxCI    }
k \9~aCI4qF 1GEy|G]R.OIy]
function calculatePosition() {Q%Vuf q,H1H
   if (xDir == "right") {
[VB%sD&b(u^er       if (xPos > (xMax - contentWidth - BallSpeed)) {%R!DN~)[
         xDir = "left";
eVp&Y;N Mb          }
\~1|d*\       }
R){PhL Z%Y:Fc%~    else if (xDir == "left") {3Ps/]%`*M
      if (xPos < (0 + BallSpeed)) {^Ds/h(e
         xDir = "right";#q4x#|%KO[*}1h6J
         }&lt!gi K0g+E o)t
      }
z)vD9W&lf3c:Q    if (yDir == "down") {
:Bi f5P&m*e/H       if (yPos > (yMax - contentHeight - BallSpeed)) {
2}7O1Ezt          yDir = "up";
2p)ae,^FJ9?3k          }9rD%v4^$}?)am/QH
      },a/O"MOJcIJ2F$d
   else if (yDir == "up") {
6O)}v xx       if (yPos < (0 + BallSpeed)) {5uT%}d,[+?
         yDir = "down";
*tG7?%~+s          }
qU*Gd5dO8[       }E-w/@bIn
   if (xDir == "right") {kc d2B3l:OI
      xPos = xPos + BallSpeed;
4z)f+`^!{T Y h       } `5m y;@ c{(yt
   else if (xDir == "left") {
nb0wa KT*a       xPos = xPos - BallSpeed;H4~[ H[ uY4Z){
      }
5nw"M$f p8E    else {2w;xn%s i
      xPos = xPos;
&D/Zg0?Y g w-\       }
bHm8xs8{    if (yDir == "down") {i'CuW,[u3m7s/^
      yPos = yPos + BallSpeed;
!pk'y}'j"^T]$c       }cJ$@gFR
   else if (yDir == "up") { x"W|)T!T7j!a!K
      yPos = yPos - BallSpeed;
9JKx?Qv:C#x3J&j T8Q       }
4G%T.mo"^9xi^(\    else {
E(G|%yg J^ h%~       yPos = yPos; n ?g1M2g} i
      }^T?'aP+iJ j3? ]`
   } N Y)H|LF
4B"LY2DU;V
function hidetext(){1|M|TL&]kk8e
if (document.all)
V _}K Gc*E] supertext.style.visibility="hidden"
3K*E6T:@q ?5F3uq else if (document.layers)
@,?;xRB9@ document.supertext.visibility="hide"
ADv [p3X clearTimeout(animatetext)"bk7P]j
}
4o2f,cu k)X6Gx @Y;|u jx(X
if (document.all||document.layers){&XAD+[^
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')(f#t } DM
window.onload = initializeBall;5m9js Lu[|
window.onresize = new Function("window.location.reload()"); n4S Mc RmN!|
}
g8mbf%rEo&\
Yn2O;M%d`+u </script>

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


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