捌玖网络工作室's Archiver

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

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

<style type="text/css">
YSO(]t-~ #supertext {
v#z1G?k8R |U u position:absolute;
L!S$\1bf7ZW^ left:0;
,bbU!z4]3q8q1k top:0;$s2o_n!z
visibility:hide; Hd8rEbiA
visibility:hidden;a;D~)LwW4[U `
}nK [8R@e t*b
</style>y W uD:hC
<script language="JavaScript1.2">
J*qe0_+Huc:u o <!-- 改变下的字体的大小。颜色-->9`t%m;d6RZ$Eb
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
^ h2GYz&B6su'w8pT var hidetimer='';'FORnXjU p*Y:v
<!-- 改变下的弹跳速度-->)X2yfZ}N/qOAyr
var BallSpeed = 20;
T#~`A2w:Kd var contentWidth;
'M7t G4L.b var contentHeight;
OQ^%g7GBG!M K"f var maxBallSpeed = 50;
-W Z|,Z7A;o/k
4H@i"Tr-}
&O3O9uWRLd} var xMax;
6sq1}#k F.btCs&\^ var yMax;
0U,U/G~/L-t var xPos = 0;$^9B7`t0@#n)^#^@2i f
var yPos = 0; [,y y;c]%Io(uP#Q
var xDir = 'right';
#Z%x7J|e2v var yDir = 'down';
X\X }/H6d var superballRunning = true;
ra-Tb9Y0syV;F var tempBallSpeed;
%Kt:b8pWL/L var currentBallSrc;
_&Je;~ Bdv var newXDir;Z+{ D$Zb!zf
var newYDir;
V8}~&Uo1\JwG
)ANMl7\\N function initializeBall() {
+r n6d |W    if (document.all) {
^Glc4c{URa%yB       xMax = document.body.clientWidth
7c7e/q:u$? mb5OB       yMax = document.body.clientHeight
|3q m(v;dkwF4N       document.all("supertext").style.visibility = "visible";
(DH!YQ O4[ |q1a,q5[       contentWidth=supertext.offsetWidth TJ*D*E+y
      contentHeight=supertext.offsetHeight
\|1^+w1gyh       }
Gi$B {W    else if (document.layers) {
H7K/d5WF       xMax = window.innerWidth;0@O/ow nY
      yMax = window.innerHeight;
Q$L olA(uz(M0`z       contentWidth=document.supertext.document.width
6i qG)K"m F V_ uc       contentHeight=document.supertext.document.height!kL(o-mh0TJV
      document.layers["supertext"].visibility = "show";
y(T[^6L1@4G0z9|'T       }
7oN*I r~n Uvd'o    setTimeout('moveBall()',400); M)j;wP#U,lF
   if (hidetimer!='')S6m+L-T K I-l
   setTimeout("hidetext()",hidetimer)
o {i,L$iYr#N    }
R g-^M-X @9?#A&|
1yT0{K8H'u&GPW function moveBall() {
{0Y'L KhC \1q Lm    if (superballRunning == true) {
#B,M4F Y7s6M       calculatePosition();nM%u(^/`~
      if (document.all) {Vtfb&fj O
         document.all("supertext").style.left = xPos + document.body.scrollLeft; }}sWD0F
         document.all("supertext").style.top = yPos + document.body.scrollTop;
vg9\8T(Ce          }
&\i:?B!mBhV8BWb       else if (document.layers) {
k7Nb$R Tl3F          document.layers["supertext"].left = xPos + pageXOffset;J'rH%SPge6k!G-M
         document.layers["supertext"].top = yPos + pageYOffset;
(tJ|S8X'y!n%C-I          }#^ PKWOy+e
      animatetext=setTimeout('moveBall()',20);
~HEuV a       }
LK"kGN/jHX    }!dmN/\V i&qmL

!doY(I9hHli:s:~)_E function calculatePosition() {{-]GfH3Cy
   if (xDir == "right") {+o"]@6mR? pe.X
      if (xPos > (xMax - contentWidth - BallSpeed)) {Q2\%N)rN3vc4]+g
         xDir = "left";$B3Dc;?yJEj
         }.i0^x&F6S#~
      }
&wNf3_jD    else if (xDir == "left") { t V&eB g b6JH
      if (xPos < (0 + BallSpeed)) {
|d }(Dp#[          xDir = "right";O@'q\7r-h.m`
         }
!p4zR:dWU_*`|lQ       }
8X.I!?vVly|,yP    if (yDir == "down") {4M)\L}1d0}E
      if (yPos > (yMax - contentHeight - BallSpeed)) {Fc"nF-YS6U&Q;D#z;c
         yDir = "up";&G p5o wIU'nv;A
         }
~p{ j.v)rxbh+U       }#e j C"m$[*kzm
   else if (yDir == "up") {
7i2w n:X,?(bl&h       if (yPos < (0 + BallSpeed)) {
ODb#uD B(?0J          yDir = "down";
!Ap!I~;oC          }
&Z m u SE       }
-v2sm.^P+Y5G }(z    if (xDir == "right") {n;h2@"iq7o/KL
      xPos = xPos + BallSpeed;*^q+ce5[K*fi
      }
'C? L,H[$M,_    else if (xDir == "left") { q#P3C8J z1uD
      xPos = xPos - BallSpeed;
.\c}v Ix1h:F7P       }P&Dcm R|Y*[
   else {
_"dn-rY)O9QS\&q9F]       xPos = xPos;
tTD D X WX%v       }4K7h*ypS L7T-rr
   if (yDir == "down") {5]rv-Yb0h^E*[*{
      yPos = yPos + BallSpeed;jw3WX!cL[Ql#OX
      },[(CV!f5W
   else if (yDir == "up") {"q g _jY2i3\v
      yPos = yPos - BallSpeed;
J7f&SP q1V(l!uJ3S       } x D$\ R`kJM
   else {_"K*kA GA
      yPos = yPos;
u;c/`0JB:t?w_OTB       }
5T#L6_wc"J;Om*qe    }
6N,l H5g\R^
^@7ZE;|3z)F#v Y y function hidetext(){ _ a}l~
if (document.all)
$]X4w2]%eOU3J^;v supertext.style.visibility="hidden"
\%sbU"F~J(R O else if (document.layers)
t*\7m,Ye7N?4~] document.supertext.visibility="hide"
%f;x!kR:Qv,tL clearTimeout(animatetext)
$[,o3j n9X }@.T/I [ j3~'S(z}y

/?6JJ ["G%QM0O:E if (document.all||document.layers){9KyZJ ^
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
/aX4|5[4M1n`O/{ window.onload = initializeBall;O#WJiRw6R5h
window.onresize = new Function("window.location.reload()");
\;sZ2k#wr$~"y}J }Wz?w)W;\8ew p
$A ` C+kL5ED
</script>

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


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