捌玖网络工作室's Archiver

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

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

<style type="text/css"> |0m9wK e"YvPq&Y
#supertext {w,J"h*HY'N7HRW*^ P
position:absolute;n+S'}'u)c7y,u
left:0;!B]4G\3_K z
top:0;|yR:yZ.b0VT(\
visibility:hide;
Gd gSwjB visibility:hidden;-X_Uv1B cRg~`
}
/Ar![F gy </style>W$NhV'ck6T
<script language="JavaScript1.2">
hED,]CVf8Sg#t <!-- 改变下的字体的大小。颜色-->e@^~ Tp5\
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
.K V0N}rp u var hidetimer='';9g-e j]&f!~Hk
<!-- 改变下的弹跳速度-->
+N`2U3[8H%bp2g UU var BallSpeed = 20;
*P:WNh)i6`9Kt(C(WPR var contentWidth;X `%j'?3oE!g
var contentHeight;
B9z6l9h&uc var maxBallSpeed = 50;
#V'FGi{U &X QyDsb PCx

M(vMCh var xMax; Y+EFE'e3N
var yMax;
t1eLJL1a k!y var xPos = 0;!^6y/T ESO
var yPos = 0;
W CN:h5N var xDir = 'right';
9WHF+N,vR,y var yDir = 'down';
$c(r&Q}A_YH5R var superballRunning = true;
UL boL ZUs var tempBallSpeed;
1e^zF:}_^r var currentBallSrc;fJu2x [+jD1LK
var newXDir;6a#{ r}D z;b1OsQ
var newYDir;,TV;a)QqQ

MD6fVAdA&u function initializeBall() {h} ~|cM Fw
   if (document.all) {
HRb"r2L X,Zw       xMax = document.body.clientWidth{ LJV3H j
      yMax = document.body.clientHeight
kq6NQ6wF y1G       document.all("supertext").style.visibility = "visible";9n+cU [dE8E
      contentWidth=supertext.offsetWidth
&?/_ ^Z u9y       contentHeight=supertext.offsetHeight
9[7u)@ Z-L O-l;N       }
|*q(Pp4|C^M    else if (document.layers) {L"`5j9VQsy7|PA+E
      xMax = window.innerWidth;\M4OC+s.e.h[
      yMax = window.innerHeight;
&eH }ZS W9i       contentWidth=document.supertext.document.widthR8iq S E8a8{O:[j
      contentHeight=document.supertext.document.heightA"v)rT8z)Lf u
      document.layers["supertext"].visibility = "show";
2B)zT)Ela       }+C"M*AySH
   setTimeout('moveBall()',400);.Z]]0yx Q q.S
   if (hidetimer!='')
Dm2D#K$g`    setTimeout("hidetext()",hidetimer)o1@^KQ!x.{1s
   }gq6Z9bU.\N

mOW|3rO(o)e9r"ELI function moveBall() {+f^7BV@*T4u
   if (superballRunning == true) {rOha n q2sV
      calculatePosition();
O.[Bb|@ R       if (document.all) {
!Q:_@NC? o#K,^&AO,F          document.all("supertext").style.left = xPos + document.body.scrollLeft;
H `(a6[cF ki          document.all("supertext").style.top = yPos + document.body.scrollTop; z]wFZR4go
         }7fpf"T_v5NZ$i6]
      else if (document.layers) {\n0Z*m3\!S\Z5_Q
         document.layers["supertext"].left = xPos + pageXOffset;J TXR@%gU
         document.layers["supertext"].top = yPos + pageYOffset;6X6UY y/C yR
         }
4f%xJu E1pRj?       animatetext=setTimeout('moveBall()',20);U,[SuU$v4vZ/a` L
      }AM#uUe.s0T
   }
2f*Q(}] GD@7W uHuzyG
function calculatePosition() {HO\tV6W:L
   if (xDir == "right") {(n g']b@8H
      if (xPos > (xMax - contentWidth - BallSpeed)) {
6^x0cB]0E8h}Rt          xDir = "left";
\E7]m$bg#uT          }Mr-j6rs%SRf V/y
      }
? R%nLT1iOT    else if (xDir == "left") {
0Q+w3Fsx       if (xPos < (0 + BallSpeed)) {
!y*XU3jR u.~w,~          xDir = "right";
0tkpVv*qq          }
;V:zd7B!q!v       }
1CH8taE#{    if (yDir == "down") {5N:e7?`2c],g3z
      if (yPos > (yMax - contentHeight - BallSpeed)) {O|5w{6n"U*l
         yDir = "up";&V6x ?B(L
         }
0Pyo8jc5e       }9P)n"L I`.Z\
   else if (yDir == "up") {
g2P|%nOn(He       if (yPos < (0 + BallSpeed)) {
'~:C.I$_1dz7t?.z          yDir = "down";
-pA\(T0^P;BJ1H          }
2Gsr8S,rK.j,v       }
]+o ]!FF;L    if (xDir == "right") {Y+p2G B.m)x J6L4V8PG
      xPos = xPos + BallSpeed;:r eo6z G_5uv4Y
      }
r6Q2\8@$E T%{5ltw    else if (xDir == "left") {j q8[So5_ H;y
      xPos = xPos - BallSpeed;t+|;HC9xy:]y"sc$p
      }
p5Z~ Fn!@j(NJf    else {@1n1Snj"` b:Z
      xPos = xPos;t*^fVa9ZuL
      }O~1^!bzm)d
   if (yDir == "down") {4@(^ K9Kv [$g
      yPos = yPos + BallSpeed;atWf#} mt/}
      }w6i+^;@H2G.Wg6q,s,S
   else if (yDir == "up") {%d2wp,^ua4v!vE
      yPos = yPos - BallSpeed;.i+cMA@
      }
@ z C~(`5N    else {,rm'z%|N3s
      yPos = yPos;yam3n:^4wRx
      }
xZ4A"Fx j6J%f],g    }m8`.je`5`TS&s

8a p H%F'l3?yD3R function hidetext(){S/QT'Am9zXW
if (document.all)
r@C'PS!PP#u-T?)A%i supertext.style.visibility="hidden"4IF8RhiU"t
else if (document.layers)
VKN"l5YKL;h document.supertext.visibility="hide"
DU ze'h pHbv clearTimeout(animatetext)zBT _,y+]x
}DtI:o1w%H[~ C v
Y [Mk~ni+{
if (document.all||document.layers){[$^/m [/j._
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
6^/mV&iEf window.onload = initializeBall;0u AK+c4]+vDNw k.l'{
window.onresize = new Function("window.location.reload()");
bDnY`"_/C Mn }
&jH#{!?6] Y'b\y-w s
</script>

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


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