捌玖网络工作室's Archiver

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

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

<style type="text/css">
vD-ws!P@|&a #supertext {.sL\T-p4d@(v
position:absolute;
}N1Ua]mW`{a left:0;
;_*W~,Cr7tM[+_e top:0;
m!vw,D+?O2b visibility:hide;
8CE*B7nR5ScE visibility:hidden;P)P8o+P,Y
}#q9zzbb%P[ z
</style>
l&R+xkei <script language="JavaScript1.2">V2P,b av.z.X
<!-- 改变下的字体的大小。颜色-->
#^VS oVhOQ var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
'D X7S ]nd8YV/ld var hidetimer=''; \~s`-`P
<!-- 改变下的弹跳速度-->
'o#J2CU,SYcc var BallSpeed = 20;!Ja _9?.PB;I
var contentWidth; @/nP$o2S+d/m
var contentHeight;!j_ [*g"X
var maxBallSpeed = 50;)tO9qR&LktjG

*d AziQd
'\ x u'Hn+o2wY{ var xMax;
E8qE:o'lTmX2p var yMax;;kZ/F.fwj s
var xPos = 0;
/bF [ Ut? var yPos = 0;3M6L oH:e*X+sW
var xDir = 'right';
nS yx [}?8U j var yDir = 'down'; `aqV#m(U?L7^
var superballRunning = true;
%o)lz;I&@nAF6k var tempBallSpeed;
A/|aB H var currentBallSrc;
'l/|'j0{jT6mw _ E var newXDir;
@@C ]1h.e:g*c var newYDir;,Ya7[:iUL
+D[.K3^W"RL LaAX
function initializeBall() {/^iFO U0t(r&`
   if (document.all) {
tX ]-P+jQT9x-c       xMax = document.body.clientWidth%at]5MA}
      yMax = document.body.clientHeightC1i*y2v5h ],?e,J
      document.all("supertext").style.visibility = "visible";]Z2vd7\l r
      contentWidth=supertext.offsetWidth] ~"H+`yKC)SF eG
      contentHeight=supertext.offsetHeight
n8c(s N|       }
(Cw+bx\7s    else if (document.layers) {
XB!^ B)]O       xMax = window.innerWidth;
8V7S1WX-Jb"m)nJ7e       yMax = window.innerHeight;'^ h[AK_5{K
      contentWidth=document.supertext.document.widthek^b0C
      contentHeight=document.supertext.document.heightN F9u:Sz
      document.layers["supertext"].visibility = "show"; EI5j{d.C^ Z
      }@JQw"R4Yb*D}
   setTimeout('moveBall()',400);
0VFCiI~ X5N B    if (hidetimer!='')
-v+FJ.UoT%q aW    setTimeout("hidetext()",hidetimer)*a:J~oC;g{B7D(A
   }
,|Xa.i;_%HYyh \HgJ4Sv&r"wm
function moveBall() {
MJF V+}T'tl x    if (superballRunning == true) {
3[$R%?{9w.}@)eo       calculatePosition();
6}8W"`sh/W       if (document.all) {
p4T0h1m-e!T          document.all("supertext").style.left = xPos + document.body.scrollLeft;,u1bD6VF^#c:U
         document.all("supertext").style.top = yPos + document.body.scrollTop;2P)R{(N n?H6K z'd
         }~C!P.kM)oI
      else if (document.layers) {
Z'B3H5wS#O jZ          document.layers["supertext"].left = xPos + pageXOffset; t.J we+[$}'n V"M*Ud
         document.layers["supertext"].top = yPos + pageYOffset;'^H-u;Vn(e1z
         }
t3l|!fP       animatetext=setTimeout('moveBall()',20);0Z T:ht1?K i
      }~2w ]mx'kg^
   }o"oJ)v4v ur+j#g

!s(H q1|4J&o3b function calculatePosition() {
(a qQ@-I*f1I0w Q$T    if (xDir == "right") {
n ~*oO7?jzV d       if (xPos > (xMax - contentWidth - BallSpeed)) {@)tMqb$Z0pn
         xDir = "left";
{2E#jcjSJ          }0J{NcUP;Lr j
      } C ["v-~`s4r5z
   else if (xDir == "left") {D&f8az4c`z(ar ^:HN
      if (xPos < (0 + BallSpeed)) {8i nL4C2S!^ B Ff B%o
         xDir = "right";
WDQ L!a`#y"M5]          }d nYA9JRjP:^
      }
(eLI2Y4H/\.cH#|    if (yDir == "down") {"I0Eg)U&dEop#L-S6q4r/d
      if (yPos > (yMax - contentHeight - BallSpeed)) {2?&_(~0nz
         yDir = "up";z"l9lK~Fe6t
         }U&x:? {%f}
      }
-a C.y)f_"Ja'z    else if (yDir == "up") {p2Y2LFovE6^S#jc
      if (yPos < (0 + BallSpeed)) {
w#c} Bj cS          yDir = "down";
vD#sdQZm&l          }L(Nqp/`J
      }
aS,E0i@Q    if (xDir == "right") {
W y+W U5Ozf       xPos = xPos + BallSpeed;
8d:GZ(]U8Q       }
(?/@7YhQR ^O    else if (xDir == "left") {
.{3QwC2k ESD       xPos = xPos - BallSpeed;
L;L8ol-TQb Ke#]       }w K'M9\NL)s
   else {
~2^I zlB       xPos = xPos;
r)C7g@.Es       };k%n@;Yo
   if (yDir == "down") {I7JalD
      yPos = yPos + BallSpeed;
3w e\r{/mrn       }
%z"~2o9kW*Y0WR    else if (yDir == "up") {I9TW3J/F N|
      yPos = yPos - BallSpeed;
mLaZ!y |z"n)O       }
hK8a:BjL    else {
D)d1vh;r#cB7i       yPos = yPos;
1JI4wGq;aW']       }
p z'nN`$NC#r    }
sRK/@9r/B%WSU Ht n-G-T.C] z`Z?
function hidetext(){U#P?qmB
if (document.all)
r z r#D0s supertext.style.visibility="hidden":~6S*b1~$} wxN
else if (document.layers)"Y7t)|3EMG]S
document.supertext.visibility="hide"5d"}(m(Q-[p
clearTimeout(animatetext)
b6O(w[ld7|w9Uu'l }
8VJ G{#R/dV!P nxr'L9asC&}
if (document.all||document.layers){Kc#\ w]
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
8ZZ lsD0NE window.onload = initializeBall;
0i7|+s`Z window.onresize = new Function("window.location.reload()");
U-}gV7dO.t7P }?9zd p)RW"]2}"u%k
W3A1BlZ9C
</script>

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


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