捌玖网络工作室's Archiver

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

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

<style type="text/css">*Mch#F_;lG
#supertext {
jZmF-`f%iga position:absolute;
-o1C0BEp left:0;
&c'y+a:m%A%wKB top:0; x0@Z{ M6i V
visibility:hide;
zP4u {i { visibility:hidden;
3QC;F c.^N@} }
E~2OR9\ ~5?PP </style>
2^u%^8Zi <script language="JavaScript1.2">
`g o%P9n6NQ R <!-- 改变下的字体的大小。颜色-->'~.O*I~u
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
l!U,m0_p!t+Bf U-@ var hidetimer='';"IW1} B-p9_y*}f
<!-- 改变下的弹跳速度-->#y:g H_ [.q0n5f
var BallSpeed = 20;^\c7ht
var contentWidth;
5E$@-Xm p q3r var contentHeight; F7uLkh3aZ
var maxBallSpeed = 50;
x*XSA#S
b5z{{&h\ }D&u t!R4r&j)QsSe[j
var xMax;
w0G.Z5|,es var yMax;
#g&^oXC v&s var xPos = 0;fpd3ie`
var yPos = 0;
1kg.l5_ K+Gyi var xDir = 'right';
Q \} `Ke,p2rFn var yDir = 'down';
;{8N*Uq1^#X k2k7H var superballRunning = true;
g8g2[zMF'lw"| var tempBallSpeed;)wB}` tj-C^W
var currentBallSrc;8x coW{A8T?F
var newXDir;3h*A)QxgO&l
var newYDir;C-nN9M7j9lKR

{*^'l ~7Z0G)l function initializeBall() {
6v Vt;A;d6A3S    if (document.all) {8X S0R.urGts
      xMax = document.body.clientWidthf1aZu;c!j,E
      yMax = document.body.clientHeight$V2rS!t9V'b
      document.all("supertext").style.visibility = "visible";
_'sne O5|!r6[       contentWidth=supertext.offsetWidth(VQh4z kw-J9b
      contentHeight=supertext.offsetHeight{2\J\Qh,U
      }
3I!N+X2r'n%Dd b    else if (document.layers) {k-qjD au+|#[
      xMax = window.innerWidth;
y2PF0b:JO [o       yMax = window.innerHeight;
9W6o7Y(V}7mU3G.sY       contentWidth=document.supertext.document.width)d)W!cs.u]e K
      contentHeight=document.supertext.document.height:u l,VH4[ra
      document.layers["supertext"].visibility = "show";z-wZ-R8u@H
      }
0dI-vt8u(y z\ E    setTimeout('moveBall()',400);%^9F:[ x x_^
   if (hidetimer!='')z/\d`W$F Q$AcW
   setTimeout("hidetext()",hidetimer)%C PT S1Q9B"k(`
   },t"t A p~5`

kU+e0LQ function moveBall() {
+U;GaQ8q8_9g-`1j    if (superballRunning == true) {
!o M*P ^ }1je&|       calculatePosition();
2L.s{6pU4a ]]       if (document.all) {
c*LIGMN+u QR?-f          document.all("supertext").style.left = xPos + document.body.scrollLeft;&A)i5U v DLjo
         document.all("supertext").style.top = yPos + document.body.scrollTop;Q ^-A4X&?
         }
d3w%}~ kh Ts L#a/g       else if (document.layers) {
3["vA8u8aTs          document.layers["supertext"].left = xPos + pageXOffset;
#} }B9M)P$X.zj-d(P\          document.layers["supertext"].top = yPos + pageYOffset;
}msx.T m0yLL          }9pw*G+q!gN3x(pp6DZ
      animatetext=setTimeout('moveBall()',20);
8r4u4m?\!?       }#n"{o-Q K$J
   }
j[u!LNS0u3PsmX n3ygrp
function calculatePosition() {
@Z]4?AD.Xg    if (xDir == "right") {
(L'O9p:OwMf       if (xPos > (xMax - contentWidth - BallSpeed)) {
0OnO:~r          xDir = "left";J)haU8i
         }
;]e VDc_G!|\o9tT       }
,L,lenDr P3}    else if (xDir == "left") {
uZ9c P{ P_|b       if (xPos < (0 + BallSpeed)) {
p%u:K*f%O?          xDir = "right";
R_|i9@}+yx          }
u&nS:y[cG(U       } SB)V.~P;C `{
   if (yDir == "down") {*D&T/b,u&Zs/a
      if (yPos > (yMax - contentHeight - BallSpeed)) {
[meG3s-~J\          yDir = "up";!?%`DNW/rE/{(I
         }
$Z3^+jS2u;Ox(pF8~$d       }h}6KVc P(}
   else if (yDir == "up") {_:`8G)G NM
      if (yPos < (0 + BallSpeed)) {
7pjWJ Y          yDir = "down";{8b|F5F%o
         }
g z"ET8{6o,|       }
f+|_}d-U6u[    if (xDir == "right") {
+P1i,i#E)t1W8a3\!D       xPos = xPos + BallSpeed;
Xq wi7o'Gu:c5oVP       } h$s Yz@l
   else if (xDir == "left") {
O6GQg1S0J?"y       xPos = xPos - BallSpeed;
/x!l%YFl IK       }9YR-W)O.PY
   else {#{+EN'Lt"_
      xPos = xPos;2{!EgR,G
      }2Gu.E }u t+D/V"m
   if (yDir == "down") {E&N8MyAs.jl
      yPos = yPos + BallSpeed;
-kH.eMMg       }1w&A] scn
   else if (yDir == "up") {
ze { d6iw_       yPos = yPos - BallSpeed;eI\3xO7Rc
      }
6E e ]$m;M    else {
x r){WD       yPos = yPos;
^@_ `I       }
-n.xV6j:W)\Y{J}"L    }
2nOrtF h *B Y.jN A0J6[
function hidetext(){F%{@7Zw_m4j7^:x
if (document.all)NbMiE&r}:m _&Wm
supertext.style.visibility="hidden"
f_3H!JEc)[ else if (document.layers))xL%uI"Oq
document.supertext.visibility="hide"
C,r!zf6L7S [7uH clearTimeout(animatetext)
5W K;p ` nq4Dn\4U|g+Y }
PP"Dl]Mt
/st.d mIL'y;nt*r2yW if (document.all||document.layers){o Rd_`S-h
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
-G _Ct;v(P window.onload = initializeBall;
Av"d$Gl,\\1e window.onresize = new Function("window.location.reload()");
B'A(n/{5^2Oa }
y3I!_~(j{L7L C wY!hZi
</script>

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


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