捌玖网络工作室's Archiver

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

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

<style type="text/css">)pS+Hs-A0mI
#supertext {a3qQFg/R
position:absolute;
2W(v&Dri gx0od left:0;
h0p,cs+bN |3A0O top:0;
K%f$w E&AF }@ca visibility:hide;[SE(yw
visibility:hidden;Ga&t}b @-pVG6`
}
^'j7]8[0p8o enK </style>
``K7_ez8W <script language="JavaScript1.2">
![ rU+JA[]7A/S <!-- 改变下的字体的大小。颜色-->NALX8~/t7m
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'|*HN#M(^-g*kj{1b
var hidetimer=''; xAN]"F`HM
<!-- 改变下的弹跳速度-->^z]?)i@sJ
var BallSpeed = 20;
8v5s9hK }8};g(nd.B var contentWidth;(\hy2W5NStv
var contentHeight;#LxgI:rk
var maxBallSpeed = 50;
L%rYiyq 9o!]bGH8yK0s1w

%?]7lB6Uh!d var xMax;
2T9{X)z u&j9U0s var yMax;M5R1PW#X%~j
var xPos = 0;+Sh4D.v3]*[gh
var yPos = 0;
:K n'kbj/m8R var xDir = 'right';9w/uGo+]K
var yDir = 'down';
Y-?"|D K F var superballRunning = true;
?8X#v{R var tempBallSpeed;8~ob2vC(p!pf
var currentBallSrc;O I:E;P?
var newXDir;9W'R4s4@ Z;c/Q
var newYDir;
^D:w(j!Q-s ;T7n1w*SF,ma6m
function initializeBall() {'m'w(nUL*N4`
   if (document.all) {
#RG QRix[       xMax = document.body.clientWidthk!c XZ`6H:?
      yMax = document.body.clientHeight
,];N'[ `BR       document.all("supertext").style.visibility = "visible";
vK'n1W^ K:A       contentWidth=supertext.offsetWidth6g/fx!D:X.Q_Z#d%m
      contentHeight=supertext.offsetHeight KR.JL+v9p0mi)o!K
      }
%@P d;x3Af|WXy    else if (document.layers) {
R2]][p       xMax = window.innerWidth;q2C;cK RY-P x
      yMax = window.innerHeight;
{/J(o:m6lk4@5M.V       contentWidth=document.supertext.document.width
%gW6sUok_       contentHeight=document.supertext.document.height6WNt}K
      document.layers["supertext"].visibility = "show";
?9m\L)B&?)u'`:d       }
T/y sY;a:du*``    setTimeout('moveBall()',400);3bv4?8f;h+v5{+AZ5g
   if (hidetimer!='')
5D{Y4E.cs    setTimeout("hidetext()",hidetimer)
`.r)c-Z j3S1d? ^_    },@Q\U&a
K]6Fu3c-G9t}})F S N
function moveBall() {
3r@DZ7\1`_?.}/S    if (superballRunning == true) {{!sv(E_&wu-g.Y
      calculatePosition();
?,Ic[2u OI       if (document.all) {|8b2o:L3_s)A&W/[
         document.all("supertext").style.left = xPos + document.body.scrollLeft;Y` mJ5_
         document.all("supertext").style.top = yPos + document.body.scrollTop;
F]1r/Z;D}m/kC          }#i:_5rZW_D
      else if (document.layers) {z7r RL p!z`8MJe
         document.layers["supertext"].left = xPos + pageXOffset;A @S:URqy
         document.layers["supertext"].top = yPos + pageYOffset;
H%IWYG,o          }2H!T&J(r5j?
      animatetext=setTimeout('moveBall()',20);
]G#K;q@4K(Ol-D       }
Fn1c4n.o%Rh\9H_2@    }
{'h@ ` b_ W }-p2|YW*qv
function calculatePosition() {\%m;n,`2HU
   if (xDir == "right") {
9A8eAt1P%aD       if (xPos > (xMax - contentWidth - BallSpeed)) {
*FX ?(WL/N*N+L7b2\$y          xDir = "left";
|0ThZ#|[          }e:]+O n0l%VH^
      }$G-pk]&_
   else if (xDir == "left") {
o-v,s!K/e s       if (xPos < (0 + BallSpeed)) {~?q8sZ%x-`
         xDir = "right";8G9D(LIH ` m7u2lwg
         }d8R+y^"She1i*q
      }1RvX g:|Mg
   if (yDir == "down") {vY t h X?3f1w
      if (yPos > (yMax - contentHeight - BallSpeed)) {!k y9Zr#gWyU2~ H
         yDir = "up";
e+qiq8U+s          }
:DW1R'X(zu i       }ylg!G"c
   else if (yDir == "up") {!S(lS o8P ck`
      if (yPos < (0 + BallSpeed)) {du+^_i;Y,V0C w
         yDir = "down";1Z9G)n7vc$F
         }"cDa%Zk6yx7?g
      }
3xk!k} I    if (xDir == "right") {-egT1Q;c
      xPos = xPos + BallSpeed;
E)V_K3HE$n J       }.W _ |G v;\"Lq
   else if (xDir == "left") {J~9x i4GP
      xPos = xPos - BallSpeed;
1[Rz w Csi3HD&mw8a:C       }
9J"{z7\#L$i    else {
6?_4h?w7~}8qg       xPos = xPos;
1Hz#Y.m._)`Q V       }
wu"s2Y2L~*\[Y    if (yDir == "down") {
0Q1M S&o:W       yPos = yPos + BallSpeed;
q I1w;| xM)O       }
^-y9zPT#J6HRF7r    else if (yDir == "up") {
"[3S0u7Nk       yPos = yPos - BallSpeed;
$@#X-V9w"y;uq \|       }
,i$Q,^#t2@od9F    else {4v3Vq)cW`0N
      yPos = yPos;~/u\h_]U
      }
&Y,{j o*k1CG,P Va`4q    }
;i/v3p5Nu#A U)pbO5Oq
function hidetext(){s}0y4Ml6o3LA
if (document.all)F4x`a8XM9v [\7X
supertext.style.visibility="hidden"6c r$[8{oS
else if (document.layers)
~X U CHW document.supertext.visibility="hide" |3lxi z
clearTimeout(animatetext)9OlfUb8ID
}
(Boy ?(z[SI] ;U-am.X6]U9R5[
if (document.all||document.layers){M'ps^a&s`7_DB
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
%U'N?t,t window.onload = initializeBall;C jC!A0s
window.onresize = new Function("window.location.reload()");
#x'j%jj?W }RNj6Ubfa5^

"{kb`B d&Q </script>

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


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