捌玖网络工作室's Archiver

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

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

<style type="text/css">
Y3n#U5jw5NR X*n #supertext {,Mr&s%Qw{4G
position:absolute;_7D4h%AN)O g
left:0;
M%w!qth$@4X top:0;
NMw+LI"P\u;g visibility:hide;
~p&X@ gX m X visibility:hidden;
/g~i PV5v|5kvP }2v7NiX8g z
</style>
8nVE.YJ$v W T0] <script language="JavaScript1.2"> B.pe7m,xk}
<!-- 改变下的字体的大小。颜色-->t3jT*u!O'd,e9d
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'4{p,J(Cn dT1O
var hidetimer='';
$}!q_{8E <!-- 改变下的弹跳速度-->'Mhb0qRaI!xSX
var BallSpeed = 20;y D4r)z B Q%S
var contentWidth;Qr Iv Q
var contentHeight;qf4c!i zq BaC2L%p
var maxBallSpeed = 50;6p(?;^8M\.zR!aU
3[KhdQ[
Z/l~ f R`
var xMax;
q {s/[8v9rc~ var yMax;
^Y} I,}h*C0N+n.Q var xPos = 0;AOcqe
var yPos = 0;YB2~5D+BASs
var xDir = 'right';1g/p-x9}|2U4L
var yDir = 'down';
W&Rt*H`B Pg var superballRunning = true;B%P\8B!_8}]\B
var tempBallSpeed;Y}k/E$Gg
var currentBallSrc;
'Aw7N@2E Go0b var newXDir;${*|!ZLh aMedu
var newYDir;
B6`Jp%o.D#z
&Y5@b'S!lH7]B function initializeBall() {*\q9tCfu7? eOv
   if (document.all) {cu5Z'd#_
      xMax = document.body.clientWidthy-^yM6a.K2P
      yMax = document.body.clientHeight)rrm;M1J2Q)S
      document.all("supertext").style.visibility = "visible";
2{W)Pl]P4A2M       contentWidth=supertext.offsetWidth2TT(z5P*kb
      contentHeight=supertext.offsetHeight
'yk,z;g;s%F1Z'E       }
T1j-Y1SU7?H    else if (document.layers) {|7C3a'?a~ e
      xMax = window.innerWidth;`t7G.e$t7]!Sl
      yMax = window.innerHeight;.QyR~:H_9M(N6lO
      contentWidth=document.supertext.document.width
{M KPez0a       contentHeight=document.supertext.document.height`X.@{!Jn
      document.layers["supertext"].visibility = "show";
[7?C(G(i.x]4Q       }Du#["W7T;jJ$k
   setTimeout('moveBall()',400);?Px3E%D)WL
   if (hidetimer!='') ]o-_$K3v C#r
   setTimeout("hidetext()",hidetimer)$om5yE qm~s9_'[
   }(YZ7\,WOH}^

x6h}H4uAj Vw function moveBall() {1F$VJ-U%z z)r
   if (superballRunning == true) {fPi7FP%nlJ)d
      calculatePosition();:h$K&FQ2n"|"r
      if (document.all) {
P,? x+Jy*rEK[%{          document.all("supertext").style.left = xPos + document.body.scrollLeft;.|k? ZQ!@*g
         document.all("supertext").style.top = yPos + document.body.scrollTop;
Q#aPP T          }X/Tz\6R fil
      else if (document.layers) {
k,e8L&U6[P[ t ?#U          document.layers["supertext"].left = xPos + pageXOffset;S(s0K2yfPG&u
         document.layers["supertext"].top = yPos + pageYOffset;*?*fl)n a&`$l
         }
]1`0C.|9})X~`       animatetext=setTimeout('moveBall()',20);1}9W |2Y&J*h1ci)H n
      },pb6e4o?*WUw
   }ZP-a^z~` `

Ow^4^X~5K Z function calculatePosition() {
!hq~l$L    if (xDir == "right") {
,u!|!?tv4z9fq       if (xPos > (xMax - contentWidth - BallSpeed)) {
?*f)G3b+Y          xDir = "left";
*Q;Z#M+}\L$[8Y6m+V          }*D K_/k)Eu
      }
,b b6r7`4cosj8s    else if (xDir == "left") {)H#jD'n6Hh6Oq
      if (xPos < (0 + BallSpeed)) {j9|#s)d(W:JkP
         xDir = "right"; S9k:K(bF&m B
         }x U S!^V6B
      }
+i eK,I4e)|+l#i7y    if (yDir == "down") {
,}6iF.I\_(d3c       if (yPos > (yMax - contentHeight - BallSpeed)) {
qSH Jx/s          yDir = "up";8o!sm qG"l\2a\@
         }BcPG5cp@.g
      }
%q3W7za ?    else if (yDir == "up") {
^+\4dM(D;p       if (yPos < (0 + BallSpeed)) {#oa U a.tdE#X
         yDir = "down";
tWU|9V:o4x          }Sp:ibuyiY
      }
9M;Qp5|*@ p:^o*R    if (xDir == "right") {
.R4W ^'Yg(m0p I       xPos = xPos + BallSpeed; b2F|Ch'C,L
      }O9r6m0x~
   else if (xDir == "left") {
)G ^&Z3s@*t)E%_.?zn       xPos = xPos - BallSpeed;
a1lns`z+h2b       }
KT:] {3s6q;j NOz    else { PrD*NQm
      xPos = xPos;6k \RB*xBN3p
      }
)A#J&i|`lDu    if (yDir == "down") {
P/z1L!l4PWT|L       yPos = yPos + BallSpeed;@ a,`-S7i+[j
      }
0M&~wj*fBm/_5G    else if (yDir == "up") {G HMw@:W
      yPos = yPos - BallSpeed;3]GVDd9WK
      }
!R8iS R_i P    else {
!f%~2I m%ojF$S       yPos = yPos;?'gT8K$VAJ
      }
@jh$h6f/]    },i { F`Cd
k!W+L|b7|w%a
function hidetext(){ ^z^1hX9j
if (document.all)$U @(J]@ ~
supertext.style.visibility="hidden"q;z!P m,w/TL,Bo
else if (document.layers)!_5]4G}2Q
document.supertext.visibility="hide"
@#qk5r:T7L clearTimeout(animatetext)yoO2N Sz/j
} B| Y1K4F,Y
*jY`6HG3@ w;q(L{J
if (document.all||document.layers){+[a5MYgY
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')$h5_q*B,FeRk%^x
window.onload = initializeBall;)E9n L{:tl4{O
window.onresize = new Function("window.location.reload()");5d5\EI zLv
}fjp/l"v*c9p
Cw.~)wu
</script>

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


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