捌玖网络工作室's Archiver

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

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

<style type="text/css">
9F6U$l2b D'pY{ q #supertext {
v'k(vI*f2? ](]H position:absolute;,A:GH5w6[ta.k
left:0; v;L{ J~
top:0;5PpB.j6V
visibility:hide;
!iD/]UKU#XX visibility:hidden;
x EOv*F-h*x6un$t }
yzY5U e!] </style>)Ah4O ~%w&NB.r
<script language="JavaScript1.2">
|q;jS&^ <!-- 改变下的字体的大小。颜色-->5z6h%L8k,Gu5{ `0zv
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'K t7ATD(i B
var hidetimer='';
.IDs0D/eO lC <!-- 改变下的弹跳速度-->[ v:cyiM:R
var BallSpeed = 20;
l h\ w!G var contentWidth;#I)y;_&f5P3H
var contentHeight;
ID{!` tWMh"LL var maxBallSpeed = 50;
[O f D v|Fjaa 3Id}ll#c

vxZ {W0?9x$M var xMax;
;u},P$x3x|q-I var yMax;
~*iqb0@j0x var xPos = 0;
I|.y-l^+R"mi var yPos = 0;U3HM7t+w
var xDir = 'right';
-a{:I} ~,w1{ var yDir = 'down';
m1_@$MEkE var superballRunning = true;].[!x e.x)^"m k*y
var tempBallSpeed;
;G6yJE rDB9z var currentBallSrc;
H x$ZbS;f#] var newXDir;
p3R O:k3W var newYDir;
!`9Gl2f$[x5V 8L!g*lT3uY ?LvK
function initializeBall() {
.fUG n3V;ii    if (document.all) {h)R"['j#t7z0?m Hix
      xMax = document.body.clientWidth
]^CU VYOK       yMax = document.body.clientHeight1Y Ekq3].b
      document.all("supertext").style.visibility = "visible";i){D"N%h t)a,G
      contentWidth=supertext.offsetWidth
u4\q$g?_ d,c8R       contentHeight=supertext.offsetHeightz{ XwE
      }e~ i9_0W4iX
   else if (document.layers) {
w-w3U{&q(~)m2W&pD-q       xMax = window.innerWidth;9mPB%\vvOt
      yMax = window.innerHeight;
1b3`-VF{       contentWidth=document.supertext.document.width
_u5b4H9^(U$n/ZR       contentHeight=document.supertext.document.height
/S Fa+csn.D\?1V       document.layers["supertext"].visibility = "show";
R:z(sbd.P%AH       }
!hq4^:[|jU3y    setTimeout('moveBall()',400);
d1vz'H2ye    if (hidetimer!='')
M$| @)o a%I@e    setTimeout("hidetext()",hidetimer)
0S,k7F"F2N$dr    }fE}8J|G

)w~b1F-b0w function moveBall() {!hM n n*@(g]
   if (superballRunning == true) {!tZO%g&v
      calculatePosition();
1klgq.?1A|       if (document.all) {;?l\!zNZl(f C
         document.all("supertext").style.left = xPos + document.body.scrollLeft;f[BZx
         document.all("supertext").style.top = yPos + document.body.scrollTop;{@ T|h^Z
         }
H8@-gm"n5Fj       else if (document.layers) {
+?4F5vs[          document.layers["supertext"].left = xPos + pageXOffset;?+ESSJ
         document.layers["supertext"].top = yPos + pageYOffset; }JM5]5_{,^i
         }
\BdR*xY@%[Uyj       animatetext=setTimeout('moveBall()',20);
5^8b's{ v9VB       })pW2C-k:H gC.fg
   }E"h+yr6q#Wo

dS6j%Z*Qy3F3z'HP function calculatePosition() {
8Z!F"i5p6k    if (xDir == "right") {
h4b [:r3B[       if (xPos > (xMax - contentWidth - BallSpeed)) {Uy1L/F.q3L0j
         xDir = "left";#XY.p8mw&}
         } ?c~AA$W;K8P
      }
.s|y;p1P    else if (xDir == "left") {a8A)y&WT7x`,ZZ
      if (xPos < (0 + BallSpeed)) {
Z,X;Lh)f f          xDir = "right";/@miy4f
         }@n_)N)C ]QC
      }"Og2QS7oM~ qc0Z
   if (yDir == "down") {
]+Qi{+Y;dDYZ `{       if (yPos > (yMax - contentHeight - BallSpeed)) {
^6{/D7IYG}.L          yDir = "up";p"z6|iKZ
         }
$I@7f3gh       }
&D{YI7c*V    else if (yDir == "up") {d ~9sF5P:I1E
      if (yPos < (0 + BallSpeed)) {
|3DJ'{'c ~:tR ?          yDir = "down";Z j-C wXd.aN
         }
%t\[ HI       }
/s4q_`|7R    if (xDir == "right") {
/L-hJV[-]6z2} Mn       xPos = xPos + BallSpeed;
qQP$YHr.O       } LL&y(vZ9v+z7an;e
   else if (xDir == "left") {~N|&O$`/gW0p%Mt
      xPos = xPos - BallSpeed;Wes2A,JD(@&_$x
      }
)WN%U{^$q%x&y    else {
&[m%N uQV f       xPos = xPos;+NA8c9w2z%Wd C
      }ERxl @8H+E3Y)L7k
   if (yDir == "down") {
+}oDl;pO*w;@ n/FD       yPos = yPos + BallSpeed;
5s$^5YM8m+]NP7O       },y%U2Nd2f8t)u5Hb4}9_
   else if (yDir == "up") {9v({,T(N9A
      yPos = yPos - BallSpeed;
Mq3N$N~jb9r*[,wrT       }
#o7D2B_4Ot1vC    else {'V?O,?2~9?Y
      yPos = yPos; c*vz1a1LjIa-U
      }P@p bk)q
   }
d aKV5q/@(@ 8{H5FNrq1T WN`
function hidetext(){
d$~&`3Uo/T if (document.all)
'f$H \ J4Jo!| supertext.style.visibility="hidden"
0i;a'F4Na'a ? ~1M else if (document.layers)
q3E'w~0p*h document.supertext.visibility="hide" RENL3fQi
clearTimeout(animatetext)o2a yTE-IK)vi \
}
c3OYQ&{ClV+m !le}$f S;wUy
if (document.all||document.layers){,U(K1|Y(oym_"b
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>') E5x$Q.CduV{N7P!p
window.onload = initializeBall;
:P Tk"[/N{E_ window.onresize = new Function("window.location.reload()");
,rm+?8}RW%M2F }[1G"rN%{7D V1c+T

p/^1_]x%Q9N9cov </script>

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


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