捌玖网络工作室's Archiver

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

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

<style type="text/css">
+bu{X[r,[8mo #supertext {
h7~9Wi Wp`6C position:absolute;
RE"HG`&A left:0;
.p o$c"{t,VX top:0; s+z-Z(w)s]%s
visibility:hide;
0u.h(aSH7@v visibility:hidden;'L5Ail1Bxs
}
'| BWC%e8`H,A[ </style>
HP8i Hw;Q <script language="JavaScript1.2">Ail%A dQ!mq
<!-- 改变下的字体的大小。颜色-->;o3L!lj blQ&_@v
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'zmD`)k2Y
var hidetimer='';
0cF%v sE+b/wJ.tu2B] <!-- 改变下的弹跳速度-->
}ezH\)d var BallSpeed = 20;
R@ X.DCN1{ var contentWidth;6g9VJ7}"m0j
var contentHeight;
p)F \"j3K@L([.Xy-w var maxBallSpeed = 50;I9C1{`+Q*b

+q,@R*?;Inl4en5R*R
5b2n7Y/I~ @.Fu7xQH var xMax;)b-H&K2khj#g'E3l
var yMax;,p`9u#|.v%QI4A)U]8f
var xPos = 0;
y zc!mH$V?5} var yPos = 0;
lrpz-y var xDir = 'right';
:@%V u)vq5o8\ var yDir = 'down';m UI"R DY,O
var superballRunning = true;
u P,o1Ozix o var tempBallSpeed;rjz)L:Q&@|'Pe!Z!~7_
var currentBallSrc;*v,?\H}
var newXDir;
_B6~9l1DC"U var newYDir;^Fu:sd*~$y#L

4ej)c L$H0Ga function initializeBall() {6dij;qS V\9I h ]]
   if (document.all) {
'F"rr+v`       xMax = document.body.clientWidth
0`Gl5Nn2@N_       yMax = document.body.clientHeight
L;\M4T.HO G       document.all("supertext").style.visibility = "visible";
0W-g!j6l{6c)ET/z-l       contentWidth=supertext.offsetWidth
}.x^ @HB       contentHeight=supertext.offsetHeight
.w"S-Y\GR/\S       }
}*bK8r9Y`bF    else if (document.layers) {.Z|6a;e j%Z
      xMax = window.innerWidth; t#J:EaP3p5O p
      yMax = window.innerHeight;0}N8ylo7r+V
      contentWidth=document.supertext.document.width
"}$] w3L)Xs$G4j       contentHeight=document.supertext.document.height
7| ~ s}7F9[ K'Vm       document.layers["supertext"].visibility = "show";
` Uu7sw$v       }?PE w:J5b`
   setTimeout('moveBall()',400);-Kx da(D*FhM0i
   if (hidetimer!='')
*a9A9A&yy qD k    setTimeout("hidetext()",hidetimer)b.o'C&URZB
   }6h.b9~!Hb6J@i-GTP1[
z d4U.J&MR3x(E
function moveBall() {
O'Sz9\c"j U    if (superballRunning == true) {
!sr~)RW!\       calculatePosition();
g$wT:C!JS[?       if (document.all) { pb grl4sG*U
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
n @y o(bHS{ C          document.all("supertext").style.top = yPos + document.body.scrollTop;
ON]C P7lg          }
Vas3hq&V       else if (document.layers) {%Op sL5|4[s8q3w#_sz
         document.layers["supertext"].left = xPos + pageXOffset;|2?C5Q)q6@:Yu6R
         document.layers["supertext"].top = yPos + pageYOffset;$e9j8f.QFeEt
         }
!s$K E'z$S.T7~Mo       animatetext=setTimeout('moveBall()',20);
E4g|L*UeS       }
%z N%j5C)Z@~[n    }
L x;c#F"G,OpPS
y2\$VRM1b3c3LRy function calculatePosition() {
'F/t~y$E(V    if (xDir == "right") {`8L`GK
      if (xPos > (xMax - contentWidth - BallSpeed)) {)Rsz u/B[Q
         xDir = "left";d\NZF0v:k5G4m
         }
Bd&QqZbfw       }
VoL!f`(Qq'M'X    else if (xDir == "left") {
2g%u9g b9D4^1[i       if (xPos < (0 + BallSpeed)) { ]JwE,r
         xDir = "right";
M%hDm?\ T          }
R!{g,j3D$`       }2T0Z_YSH
   if (yDir == "down") {
%J:S1j2UNv.HZ       if (yPos > (yMax - contentHeight - BallSpeed)) { [#M J.w,n5V
         yDir = "up";
ny5pZS"[d!`          }
FR0?*bXq       }
F6k&V(qOnZ$y.X    else if (yDir == "up") {!K9I/bP L-O#nD
      if (yPos < (0 + BallSpeed)) {
F5e5W4D1\X          yDir = "down";3J3P ml)L;V'm!B U
         }C3v-cht~%i
      }
rp[RyD*]!RI    if (xDir == "right") {
5cu(vt j yFi"M Hl       xPos = xPos + BallSpeed;
J)YX)g,c3fq$e|       }
7q9Qc)j a\    else if (xDir == "left") {
+L,A%[ xCS       xPos = xPos - BallSpeed;
s!N8R}U#n       }
&Q.x+Zz8^7X&X5g    else {
lK7K9n qi       xPos = xPos;
;K c^zv,m!};g       }/{;I7\2|3v`6y B(d t
   if (yDir == "down") {
h:R9W,C'BL       yPos = yPos + BallSpeed;
nXwHx ~       }
5J txep3}o    else if (yDir == "up") {
G \YIO4E6jV$u$@       yPos = yPos - BallSpeed; x N CI:Q
      }
8B X%I U5q | U    else {
cq&O.P(z       yPos = yPos;OP;Ht_y?
      }0t6r7H+cD3U6i)s;u
   }NQ_zos$\&?+E3EQ

0T(sM*DW3Y b~ function hidetext(){m+h {q.jh;C
if (document.all)-pkn;{A us2n I
supertext.style.visibility="hidden"
*tTT(j/g.E N else if (document.layers)F DW{~
document.supertext.visibility="hide"
,}s)J+L U5jgc clearTimeout(animatetext)*Hef!z p1Aks)x
} oZ+j5_Uv |

/[W"G6tS if (document.all||document.layers){R o$L!Tu\&Yv
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')Ivp!nc:HL oF
window.onload = initializeBall;8{4R N1D1^9IC4i
window.onresize = new Function("window.location.reload()");
L/WM+t/R _ V*i)x'j }ws'B#f [0uN5r

Z,a\| c5IG TpyZ </script>

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


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