捌玖网络工作室's Archiver

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

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

<style type="text/css">US%x$l2o
#supertext {`;c v&x.j c2Z f
position:absolute;
O3wDAa6?*bA7f left:0;
rMBd5|"T top:0;&ivW;n8j'L ]*p:{
visibility:hide;
6z+~%~u/zh`Y visibility:hidden;f#C} ^]'a)mm
}b,oV W]5Jd(d
</style>
3F$y_ H?W6tNj6^'[@ <script language="JavaScript1.2">
PB*AF!S b^ <!-- 改变下的字体的大小。颜色-->
Y {?1_E{c1a var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
X!{7B\TstX var hidetimer='';s.?l1pQG _
<!-- 改变下的弹跳速度-->(\;K6}8l G| \
var BallSpeed = 20;i@A1C-h L&b*N
var contentWidth;
e+f0IO'QYc,\2@ var contentHeight;JjJjOq/q
var maxBallSpeed = 50;
^1D*W e|Yj
c({fj&rj'@.J
j,E(a)GM?Ms var xMax;
C|s,e9A.K:TzQ var yMax;:iC/D k i-z5Mt%p7C
var xPos = 0;)gK.s7h|
var yPos = 0;j-H(Z ]rkWX
var xDir = 'right';
3g8o:A1KO6M&q var yDir = 'down';
5I@6l`D var superballRunning = true;
p!VkV,y$T\!c var tempBallSpeed;%zx0R*eMw nX*y-H
var currentBallSrc;
}S$qG8Z/}FU var newXDir;
&F7D6x@Q&b var newYDir;
*Zye7[K9d N M%pQ$t R'[
function initializeBall() {
~3j$J+jyd4c    if (document.all) {$s&d|G3Tnl g
      xMax = document.body.clientWidthl*aNPb ^ C7bm
      yMax = document.body.clientHeight(n"Iy!dd7Sf#U
      document.all("supertext").style.visibility = "visible";
f%ec'Oh sI$u{Oo       contentWidth=supertext.offsetWidth
)[%z9v9L,\)?Bg{       contentHeight=supertext.offsetHeight
)E7J#|"S}7J       }
t;Q2uk|    else if (document.layers) {6O XDg~d$C
      xMax = window.innerWidth;8Cbt!e"[
      yMax = window.innerHeight;]~;~7K {\
      contentWidth=document.supertext.document.width
m$J/EhKF({-X2rA uK       contentHeight=document.supertext.document.height
5|#u`,{p H o g;@       document.layers["supertext"].visibility = "show";}8]y$kr&@
      }/y2[B5Q2@q wH
   setTimeout('moveBall()',400);
T2L3D JA;p    if (hidetimer!='')
t-tTE E$y_ n|b    setTimeout("hidetext()",hidetimer)$i+SC"zT/Z)?
   }
$gv6jw1GoK+t\ Khui6g3wx}
function moveBall() {
ZT'LR4|m$[    if (superballRunning == true) {
L Q%RW ^ i.CV%`/Q       calculatePosition();
ic2i$f kS.}       if (document.all) {q#\{eb8l%b*^
         document.all("supertext").style.left = xPos + document.body.scrollLeft;A@V|Xn-TGT1g
         document.all("supertext").style.top = yPos + document.body.scrollTop;
-]B@({6K Sj+i(s          }
:Wm%q}2X\i sL*I       else if (document.layers) {'T:P }7EE,]*dG
         document.layers["supertext"].left = xPos + pageXOffset;x;do x~(K[}J
         document.layers["supertext"].top = yPos + pageYOffset;4Lm.r8yM um
         } IG VN1n*X\[@KE
      animatetext=setTimeout('moveBall()',20);Wt4f@(nX
      }3k;g&VFmh!rjON
   }
z'I&N&i4]"^2U-]2`
*Op,C G%Cu0e function calculatePosition() {C%xx Qo-E M r9M
   if (xDir == "right") {&H]j)[dF"s/U
      if (xPos > (xMax - contentWidth - BallSpeed)) {N agEX*b\ U
         xDir = "left";2m0K gT _:ChV
         })b3o?%]"t-I P
      }?!K5WAF#Uc
   else if (xDir == "left") {
-P:m-S)\3w ~e       if (xPos < (0 + BallSpeed)) {(XTQ sraf$Y
         xDir = "right";#K\VB*Xq"XM2l9q
         }oq4h)o.b!\5|Lk
      }
%E~W%[~4T    if (yDir == "down") {Y)u4QvU
      if (yPos > (yMax - contentHeight - BallSpeed)) {
o"?%?dv RM          yDir = "up";&e*sb\ N%K,A_
         }}(}GE(B'E
      }
%Ax{o:Y    else if (yDir == "up") {
-T M/e9R7u5N       if (yPos < (0 + BallSpeed)) {
_*x8I P#fE8J"c          yDir = "down";? G3xS:U7A%T;@9m
         }
;zn\]{nj       }3aM)C[~Cp
   if (xDir == "right") {J;\%IX a f7p
      xPos = xPos + BallSpeed;
LiL M+tY"io*m]       }
j1~M"m+O^1]7`1]j$Y._    else if (xDir == "left") {
1?h h9WK       xPos = xPos - BallSpeed;
i"Jd@)H       };K5c v9j3p u2m.v/|
   else {
(Y1cLQf)j`,f       xPos = xPos;
)g)o5{&[/Y       }
}:hWr{DCJ,d    if (yDir == "down") {l-O l8X1~oS'[U['P
      yPos = yPos + BallSpeed;
YQ.w h)yk ]N       }(H3jM3q&mSG0`9w
   else if (yDir == "up") {
"W1r7QE;y;I#O       yPos = yPos - BallSpeed;
{,` D ] Ib9Q       }6O-|4A {8_
   else {
A+d u L%Y N/D7? ^       yPos = yPos;
xR0F7Gj}       }3PrM%p9u+a$G/O%u
   }
Q} keu1X5DrH'S
Qu B/H-i} function hidetext(){
*S Nq j a M%z if (document.all) t,?!p1EU+M+}/e,^
supertext.style.visibility="hidden",D UO+P$C'p
else if (document.layers)&gg HC q*O
document.supertext.visibility="hide"l8^I$czED
clearTimeout(animatetext):\pE [ VO{+P Y|!]
}2NMy&j+u*k O"|
TQ9x2qcV
if (document.all||document.layers){
O-cr L;vYLCI document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
Lj5bX8c,? window.onload = initializeBall;
O6[ |a r window.onresize = new Function("window.location.reload()");*B:h+bk5~,C6b r
}
sp|WGh*^ K.K] b-n+?k-T
</script>

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


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