捌玖网络工作室's Archiver

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

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

<style type="text/css">+_-FJ'sw [(i
#supertext {H#F(D `{2j
position:absolute;a~5G'u7@/_*hQ\
left:0;
,b,bh%tg*l1e4C top:0;G'^#[-wD
visibility:hide;j$N&|Xx"uG
visibility:hidden;&D/TV}NvC`#u?
}
fF.u&t%V IcS)m5K </style>
w Xgc F1WD7jb <script language="JavaScript1.2">
Wl*z(e$R8Af <!-- 改变下的字体的大小。颜色-->$DK9\0eH1}8t#j
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'F \5fy3bVzLL8_
var hidetimer='';!CE K3_6i1t
<!-- 改变下的弹跳速度-->
W9Fn"QI var BallSpeed = 20;
$Nc%t7`&a var contentWidth;
jKM9@"A var contentHeight;C6H(@ |2d9FS
var maxBallSpeed = 50;
JPK+f'l m)c
*U_S Q1R1V ?6ddge
var xMax;,Fy{QTM(c
var yMax;~`&O"U q1\*O
var xPos = 0;l UodN{1e
var yPos = 0;%f gpz0vZ?
var xDir = 'right';
f{:Y EV var yDir = 'down';N,E;Jm2AXZ-f;~
var superballRunning = true;
8q4I u x{ Cs/To6G var tempBallSpeed;J0R1n ^&B;c3Y-M*K
var currentBallSrc; _!iv(L x x
var newXDir;
V k%C){.V-KOM var newYDir;+Z] HA*a

#@egw1A,d"fF function initializeBall() {
`7{o5]_w ipr,~    if (document.all) {&M HJ^`8x}/L
      xMax = document.body.clientWidth
q` qz7K#G(S/tc       yMax = document.body.clientHeight
5z@7HL Z1M       document.all("supertext").style.visibility = "visible";D9bO0N)I9Y| ~_
      contentWidth=supertext.offsetWidthUfk$gt3S
      contentHeight=supertext.offsetHeight_I1y,\%sf.|9bI2F
      }
s{-E/M4m X^"R    else if (document.layers) {~*Xt[{]
      xMax = window.innerWidth;
h;g1h;zz0]4c-`.b       yMax = window.innerHeight;
6f'HY&fs:\a5{       contentWidth=document.supertext.document.width(J#Y7RQ&s1?&tF
      contentHeight=document.supertext.document.height^5DNb A[sl
      document.layers["supertext"].visibility = "show";
yOz6]u k       }
jh6bh7Q    setTimeout('moveBall()',400);:`9];WDh'g J
   if (hidetimer!='')
/s8eI1N1@`)gH7?v t    setTimeout("hidetext()",hidetimer) is+`J f+u9Z6~e
   }
)RVO+N] ~ tM"iFx#j8[[
function moveBall() {
M)`ZG3xC&ZFI    if (superballRunning == true) {6Z#EFX9g l2D6h3Y
      calculatePosition();
u6G^?7k d \       if (document.all) {
/r1N {v!G \~          document.all("supertext").style.left = xPos + document.body.scrollLeft; |U2[N.l
         document.all("supertext").style.top = yPos + document.body.scrollTop;'Uk] u9N0y3G!p%b4H
         }
(j.| r^V%Do jAk       else if (document.layers) {
#YJ8AW,p/J          document.layers["supertext"].left = xPos + pageXOffset;
_1g/h{8oc,}%w          document.layers["supertext"].top = yPos + pageYOffset;y n!T0Mk qS0f X n
         } G PD*EyQ,xK:tC.}o
      animatetext=setTimeout('moveBall()',20);g5[`&{%SB*GQ _
      }t"qk N-f#v4S
   }
}:T6fF;Wr
6VND e]r'nF*AFq function calculatePosition() {
?yz \@ | nLs    if (xDir == "right") {6cBS"irL6A
      if (xPos > (xMax - contentWidth - BallSpeed)) {wH:bnn;i8A
         xDir = "left";
+O\K`:H          }3L.s }\0Y&w,t
      }-?M$O j_ E#uI\
   else if (xDir == "left") {"QL0\,I`8T|9DU
      if (xPos < (0 + BallSpeed)) {Q j:s-EM1O
         xDir = "right";5B(Th aGG#S
         }wgu:] HOv6{2j7Q
      }
%O!](h)[)m JQK    if (yDir == "down") {?L'IPZ,_7i
      if (yPos > (yMax - contentHeight - BallSpeed)) {
r }+K HR1{9A          yDir = "up";
~;W1r V"cj/d o5}          }
2^|U4k i!fC(rf%l4C       }2\7KN ^e lb
   else if (yDir == "up") { vmH&i Q,G/o4fsL
      if (yPos < (0 + BallSpeed)) {3Fa*kX5U p
         yDir = "down";+p#Re a&}4@)to^1r
         }
?~}4bx/m       }r:tD2ff
   if (xDir == "right") {
:iPP(u,mO s@&d       xPos = xPos + BallSpeed;8[f)m}q`'F0ao_E
      }
\S6[,_*n|2^O    else if (xDir == "left") {2P^ rh7I@Z!k8QP
      xPos = xPos - BallSpeed;
RSY~*W!h       }S!s:H] cs6A*dB5Rx
   else {L,jl,? q @|'b
      xPos = xPos;
+L$zZ9@'L0p       }%Pi*q@kIU2M
   if (yDir == "down") {I/C]@-{
      yPos = yPos + BallSpeed;
A zr0xP8P7u p       }
"fW]Q6M/?    else if (yDir == "up") {
x&U(wg}q'V       yPos = yPos - BallSpeed;
w'bxx?1j2L       }
E3jV{!~`$P*a6X T    else {9_| g ]$E
      yPos = yPos;
@H O:q#oV4\       }6M:eI4R8f
   }
B[#I he zV7@*t5@
function hidetext(){6J&A)q ]:L
if (document.all)[1r9vy e"h%Jti
supertext.style.visibility="hidden"
/T0u7M2v6Af*W&T else if (document.layers)
%Yw3aK? zy document.supertext.visibility="hide"
6Rn @G3m{+oZ clearTimeout(animatetext).m-TS4z~-G!jL
}1v`B3a CK~I S
8GWl*ZXO9Z V
if (document.all||document.layers){Ol@ y"p i&W
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
XD6b9dA5Tu window.onload = initializeBall; _7| u,Dk*w(`
window.onresize = new Function("window.location.reload()");e*VE}l w1T
}
j8u;K`t7S,ga nw!C a@+Qc0i
</script>

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


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