捌玖网络工作室's Archiver

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

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

<style type="text/css">bb\*qDg
#supertext {
Cj.NP^)s position:absolute;
+} hE^'i left:0;
q$G0Q,{s#g top:0;,ey!mz,a,z D g
visibility:hide;
a%s"L$]$C visibility:hidden;n3U)n&Z V
}
D(q*W0z/ZT [2GsUv </style>/sg\S wn j1H
<script language="JavaScript1.2">4P+U,kV e5VVs%_
<!-- 改变下的字体的大小。颜色-->9aCrc6p0C
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'(B9k*[#{ E&ksz
var hidetimer=''; nAhS:w L4G
<!-- 改变下的弹跳速度-->
YVSte var BallSpeed = 20; BS@ AT
var contentWidth;'| }5^ u2b-W N,][
var contentHeight;[6aKD1FI[
var maxBallSpeed = 50;
/PRB%dc;c8ONGK T4]O(M)K]{ e
] n2e_,a#e }e
var xMax;
6R5n.P/w&U!G4\ var yMax;
(?i EqgM r4i| A var xPos = 0; W(lWy(GoN.]
var yPos = 0;*THqH*y
var xDir = 'right';5C-pXH YBG!WC3{
var yDir = 'down';+k-d/t7h;Y'p.Wa'B(x
var superballRunning = true;
&a P2k^t&nQy.B ^ z var tempBallSpeed;
9i0aI,J@!o var currentBallSrc;
!~U0\4VR jg/w l#e var newXDir;'v7r6J#z:zP^7{-wp
var newYDir;
v:u q%z6["C
.F$ud){"rcQ function initializeBall() {
-k ^ rgX H*z3vxm    if (document.all) {
tgVs'F(OL       xMax = document.body.clientWidth9}HN;F!M+_$y D#W
      yMax = document.body.clientHeight
E$s/cBM       document.all("supertext").style.visibility = "visible";&JO8h*v3RSnf
      contentWidth=supertext.offsetWidth
Q6P%L,r_"\ @ `       contentHeight=supertext.offsetHeightgI2d)wR[
      }
eM-hU)aXX#?I sy    else if (document.layers) {
4bS9],l7y+F AaW       xMax = window.innerWidth;
!~9sQX#kLZ LC       yMax = window.innerHeight;
4l/v"bsj*J5Rz       contentWidth=document.supertext.document.width
Ukht I0`l$U       contentHeight=document.supertext.document.height
O7UX7KG;o%k^       document.layers["supertext"].visibility = "show";
+VnSJKYT(\       }?4` |7uQ[E0^Lo5[Q
   setTimeout('moveBall()',400);mS$DNA'v-I1g
   if (hidetimer!='')7dzu\!T)|_!W.A};O
   setTimeout("hidetext()",hidetimer);ft+nOQbco
   }4e3mUW iC5s/J

rvm$\0z'd!p r!wZ function moveBall() {\7qa~.I'WH
   if (superballRunning == true) {#|{|/Lw
      calculatePosition();4\xP$Wn`;\S.A(`?
      if (document.all) {
@N uM&o)H"?&`          document.all("supertext").style.left = xPos + document.body.scrollLeft;L&A(@ SU+v/J
         document.all("supertext").style.top = yPos + document.body.scrollTop;
k:iO fs~          }
^/H t4w:\pN L"b       else if (document.layers) {
&[.G,lB"~d2y          document.layers["supertext"].left = xPos + pageXOffset;"l$vq.c*@4FaV
         document.layers["supertext"].top = yPos + pageYOffset;
.?`?9e(B"t`          }
j yA,pv       animatetext=setTimeout('moveBall()',20);
jV{ Qh4iHLP       } W5[l1w$|5tj6d?
   }I4Q YG'iD0|!w
3y;? Yp KB6nH^|
function calculatePosition() { Ep3qG OlQE
   if (xDir == "right") {e+vJ&Np`(kh
      if (xPos > (xMax - contentWidth - BallSpeed)) {
*OW'vkP g+s-~(aJ          xDir = "left";
m?Q1s~/H-Z          }
1p6bX.x)]4Z6D0^       }
#|2G)~N(E2z rqUP    else if (xDir == "left") {tBZzw }
      if (xPos < (0 + BallSpeed)) {
*J g7t-bO          xDir = "right";
KGf%ic8FX,CSi s&i          }
jse'[(e })i:lC       }+g r,R#e*J-B
   if (yDir == "down") {f'p'`n bJj+tX
      if (yPos > (yMax - contentHeight - BallSpeed)) {
SER$P0F3KC\ p          yDir = "up";o7A N-L:?)e
         }
"JBvyh)HY ru5j       } RV-yiIyf
   else if (yDir == "up") {+] mVmG'f l
      if (yPos < (0 + BallSpeed)) {,z"At)`S[
         yDir = "down";!za%v,kt Rt"p5B
         }zi_(R:_7c:M9E
      }
m4ed(VeG7K    if (xDir == "right") {o/^3tP?
      xPos = xPos + BallSpeed; c[F(T_"o
      }6gg"C~ U? [ P+R|K
   else if (xDir == "left") {
Y g+p(N#d2Oi^       xPos = xPos - BallSpeed;2C]E N a:t%^WOaU"W
      }
S On8A%e8q7Uz    else {F ] _*nK
      xPos = xPos;
n,}4Z'zxqu       }
}Zv"R L^z"yU1T    if (yDir == "down") {
6Y3M/tc^(cLb \V       yPos = yPos + BallSpeed;
M S+L/N o{V&y'M       }
IF,TH#Y\,qG)`)B    else if (yDir == "up") {
UT*aam       yPos = yPos - BallSpeed;
Iy;^7K;o2w9KmX \       }
Bn)_$^g _    else {
5ctj5|Pp       yPos = yPos;
8\6hQk-T;S       }g O}h@7u#D1J
   }
2cm ]%n6^-`@
$qCI N \ function hidetext(){EuE'frNk~
if (document.all)0i_){8oGj4x
supertext.style.visibility="hidden"W3YNp~L
else if (document.layers)
t$CX_,H+_ document.supertext.visibility="hide".p a Pgf F
clearTimeout(animatetext))rP:~~*y&?5A4D;J#s w
}
:]n%f$_(Cyd*EQ G)o
*YC"yb6YG)FJ if (document.all||document.layers){
jDUx$Nq'} document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')5j*th.@z
window.onload = initializeBall;#~ SU:x&s:t
window.onresize = new Function("window.location.reload()");ED3}&zr{7JY
}s{.{d1Y Y7R
*IgQK0I{F
</script>

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


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