捌玖网络工作室's Archiver

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

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

<style type="text/css">
dL)TE1u^ #supertext {~5T.y-^C P5j;gA
position:absolute;
_!s3Tcb pY0Sd left:0;
nD'^8g0m~'yq.b0s top:0;
n6g,c5CvYm visibility:hide;7T&[u^B_V
visibility:hidden;
N&@.`W pv8s+l }
|rMC5C AdI </style>
;y a^YO <script language="JavaScript1.2">|RbO8x"c-h+x
<!-- 改变下的字体的大小。颜色-->XV*v\:\CFZ!W
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' YD}!V9}D Lx.F O
var hidetimer='';E7~j Q*S1Rk'V
<!-- 改变下的弹跳速度-->mDK9g9@-D
var BallSpeed = 20;xqd*d2M
var contentWidth;HB!v'{Ws$`s0m
var contentHeight;
-E{!U&Q2k var maxBallSpeed = 50;
e|we&S%_ R,p\*p
_tn [(]swN2p~q
+ywdEAm7R var xMax;
k2[,Zkt}kr/b7]7y var yMax;6|4FY,Db-Ioz
var xPos = 0;
(Iz)V!a0Q9u1V+\$B var yPos = 0;
1\y4Xe[-p"L var xDir = 'right';R"JPk G
var yDir = 'down';
@mS K6D)R var superballRunning = true;
kv }y(w var tempBallSpeed;!_^ tF nNd[.c
var currentBallSrc;)t&|2I^a+mJ"R"f-a$r
var newXDir;
l%X,L jUn var newYDir;
KQ7^gfQ0GH ^VA?9o
function initializeBall() {7`*KV/{d#e ^GK
   if (document.all) {hdoWV G.v.L%_
      xMax = document.body.clientWidths+\6i*H{6i7X!b
      yMax = document.body.clientHeightxC/qkD~ m6t`"y
      document.all("supertext").style.visibility = "visible";/Z1|3o&V9t[4sYsz
      contentWidth=supertext.offsetWidthUB0^%? i$Y
      contentHeight=supertext.offsetHeightp+]%im$e,U4u PC\
      }
,GUb uRe    else if (document.layers) {B w#? M*?g\2C,\
      xMax = window.innerWidth; l%{1vB1II6T
      yMax = window.innerHeight;
X1BwEr       contentWidth=document.supertext.document.widtha1MV&BJ]0Tt
      contentHeight=document.supertext.document.height
kkw,D/| wA ^E       document.layers["supertext"].visibility = "show";
GTx*u4u'H       }
W vX3K?6`z    setTimeout('moveBall()',400);
2e8xE,|j%X7Ws(dr.C    if (hidetimer!='')+V;N%JU'u
   setTimeout("hidetext()",hidetimer)x6L C7Uu|`4Wl%x
   }
0\G;a7{;tK$c&x } PBu(T;} B
function moveBall() {
(O { Z I(h L({ B8G    if (superballRunning == true) {
A r6H*b1f |       calculatePosition();tziWP
      if (document.all) {
&O%h$V-f"b`          document.all("supertext").style.left = xPos + document.body.scrollLeft;
MS+d0Cbnl0y          document.all("supertext").style.top = yPos + document.body.scrollTop;
:FZ*oG_"h0m;_^          }
b uip/K       else if (document.layers) { _ n"t%CX"i
         document.layers["supertext"].left = xPos + pageXOffset;/sHC6j-O ^u&_&L
         document.layers["supertext"].top = yPos + pageYOffset;
0UN&t:u|lAa)g          }
+y0n__Jk8C9h       animatetext=setTimeout('moveBall()',20);
@]Rj*|;SI       }e5M5i|)i(g
   }/e"]?w'bA,T+j

n J&@k:DwDu a&y function calculatePosition() {{~6Q(^Wf4uk ~.R
   if (xDir == "right") { J @l:l0[$Q6i@
      if (xPos > (xMax - contentWidth - BallSpeed)) {.l)m8nVr E `wJ}
         xDir = "left";]I#s6R P;d
         }
Y{1J{#H;K?I s       }h6\;t6b p O3{
   else if (xDir == "left") {/h0S X0h Zu[&r)U
      if (xPos < (0 + BallSpeed)) {;n\F$\?*@+Ic.y\
         xDir = "right";
&Q:BH kQtU          }^0S5a;M n6I}
      }v J:fT)iFE%c
   if (yDir == "down") {g$O?;sr1T
      if (yPos > (yMax - contentHeight - BallSpeed)) {]t|0t?
         yDir = "up";+b:N/Br V
         }P t[&Q_
      }
3Hs ]O2^5P1Y6B6Oks,p(S    else if (yDir == "up") {
4w&YqA/eH]8F"o9B       if (yPos < (0 + BallSpeed)) {
Y V%h&I-QR:Kmb*M.v          yDir = "down";+gQ&c C8ne
         }
vZ"\ e:i4Cf       }*V-J@ E7]Z2[
   if (xDir == "right") {
W d(r1[NWwY@       xPos = xPos + BallSpeed;0J7L(^#p~"@
      }!I5w4s.uV.CetC7I+[
   else if (xDir == "left") { yq sxa/]o GR
      xPos = xPos - BallSpeed;
\Yl4a+bR^o       }
Dj#x h |2{ x t    else {
2K r%bb P       xPos = xPos;mkb9c f FW
      }"W(^ U7i3T(XR
   if (yDir == "down") {Nq8w;wG/V.s
      yPos = yPos + BallSpeed;
-eq@5w+nP~MJ!q rd       }
g{4}'X"`*G3w4kY    else if (yDir == "up") {Fn(n CUzx5ICs
      yPos = yPos - BallSpeed;O5x6y o } wP2G
      }
/aw c5iT&Xd6f    else {
)Z"rk5g5pc]onO E       yPos = yPos;
R9c(K(nF!JU9r       }
-I RvCEU    }
hF m-]#Rh)x'k|
t0R6Gka:Q M!} c kP"Q function hidetext(){4f+D/S#r.og
if (document.all)0D7Q7Y }YJw)q*~[
supertext.style.visibility="hidden"%WJ@.ImN6uE%q
else if (document.layers)
8W&Z Rm!j$| document.supertext.visibility="hide"z_:{!p%m
clearTimeout(animatetext)VvFc*]M
}
5u Nt~c 5?%i3V$r"bD
if (document.all||document.layers){n\{,n8F2l6b4c5j
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
4bq:eP!g ~ window.onload = initializeBall;
s aU[9e+b\sD window.onresize = new Function("window.location.reload()"); d4Ut,L2| aD!Ayyf
}
Z)U,|J K W` qZ$Y
</script>

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


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