捌玖网络工作室's Archiver

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

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

<style type="text/css">Xwe6a&|:f e
#supertext {7t#]fLXx,QB}
position:absolute;fje s:Nq.gk:y5@
left:0;
mxq z6_Zr2G+Ra top:0;+eB$Z w_-Q H"{
visibility:hide;[3W-` C3^&I3P
visibility:hidden; T,T2y N#L]5U~M
}
;~'eEex$^ </style>
LK3|gbQ <script language="JavaScript1.2">
hVS Dp b <!-- 改变下的字体的大小。颜色-->
i m.`~G var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
3thbJ.Gy var hidetimer='';/vL AF7wh
<!-- 改变下的弹跳速度-->
SG| D6Y;ZU var BallSpeed = 20;O-P/A AL
var contentWidth;fl vZfR*d
var contentHeight;6JpcF/?:Y#y"b
var maxBallSpeed = 50;
%k.y Km~yK
5M8e&? L9pQ
6ym |"`Tf*\ var xMax;;mcB6\?+}5w9Y
var yMax;&?.`[_o
var xPos = 0;mhP1ic,R
var yPos = 0;$|%E;x(m$[5IG
var xDir = 'right';
w,~Ab*V _+[W var yDir = 'down';^:lV,JO\I
var superballRunning = true;~iseF5mwU&r
var tempBallSpeed;
b*C$tH1?I!`'ie$T var currentBallSrc;ag7\*TEb
var newXDir;
F [/L2goOf_)[I var newYDir;
,N&u,F)a3LP ^4M
!D*Ts}l'g function initializeBall() {
-er8P)q%g    if (document.all) {:zu+|nOO.~5gj
      xMax = document.body.clientWidth!D[d%U9_fdb
      yMax = document.body.clientHeight?q`_ hdt8w,s,?
      document.all("supertext").style.visibility = "visible";eb6{.{%b!A3hq
      contentWidth=supertext.offsetWidthd^#g.E/Jq6j&Mn
      contentHeight=supertext.offsetHeight
/Kk4emUqUV*Y       }
:I*y&EK/s,G8rQ    else if (document.layers) {SNNLb}+Sx
      xMax = window.innerWidth;6QoCH6W hl1`5F
      yMax = window.innerHeight;
!b@0A3S!iu       contentWidth=document.supertext.document.width sz7G%EA7f+g
      contentHeight=document.supertext.document.height
}%n+KLD5?       document.layers["supertext"].visibility = "show";jd$`v;?0Y
      }G'F$^2^ ]dS5C+Q(pv
   setTimeout('moveBall()',400);
(dJ~UG.|J\$i9T |;k    if (hidetimer!='')
){JS{ l!i7d^%I6T/J    setTimeout("hidetext()",hidetimer)fm xG9mW{_{y
   }
_(p rd.@.UV "oS'RJZ#mG
function moveBall() {
Hy!At;M3N~    if (superballRunning == true) {
\x!L,~@BH(v       calculatePosition();
1vuLFZ { TWB g$V#E       if (document.all) {(Is#o-F};mMC ~ S
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
$~ } s.nl6T[Vl          document.all("supertext").style.top = yPos + document.body.scrollTop; J(K&F k9t;SU[
         }2lr7D3YZ4d`+D
      else if (document.layers) {/C k"G9nPr
         document.layers["supertext"].left = xPos + pageXOffset;
FNEq4c*^8`H3b,P          document.layers["supertext"].top = yPos + pageYOffset;Pc4Qcn
         }sZq8l bk.t
      animatetext=setTimeout('moveBall()',20); q:@3?bm N
      }
,D$u|z5le'O4o }'I    }
{)by|~:I |&i{6X 3d nW-o6M [c,@ RG
function calculatePosition() {{1a$T0f8^$ZbG
   if (xDir == "right") {~2M0Lx)b
      if (xPos > (xMax - contentWidth - BallSpeed)) {
fcel7Eij          xDir = "left";$F8?m1y(lI%Ee
         }
"fLH3}%B.A _       }?1M#SMW(Z1v2n8D
   else if (xDir == "left") { D%^qcK3f#_'~l-q
      if (xPos < (0 + BallSpeed)) {
9PZ5[ |.L"X8r:s          xDir = "right";
G:DOf3A1I(`          }
4OHZ`%{4{}!ML       }
i C&aV-p4\^:l(m{|.?    if (yDir == "down") {Q-mc#l,`W9{3dgT:K7z
      if (yPos > (yMax - contentHeight - BallSpeed)) {
9ku3J i7@          yDir = "up";
2N d E|8p}7S$V          }
+Wh m[tc"^x2CT_       } E[mV6p8a9d8w
   else if (yDir == "up") {
wu@UW]g       if (yPos < (0 + BallSpeed)) {._;[4]@Mnp{
         yDir = "down";
5mZp;A%l` q!?n          };p];j&~M/Sg
      }
#B@f4|}!jq    if (xDir == "right") {
]O:`0})war1xm(U       xPos = xPos + BallSpeed;n"P6P Arfm{
      }.NUy*mKWEuG
   else if (xDir == "left") {6Z Zi%dAy
      xPos = xPos - BallSpeed;.H.PCPT?g7M4]/q8XL*I,}
      }3@y"}#JS
   else {4l0Zd6p'v ^2Li-x
      xPos = xPos;']b9U;f O5}
      }
^f7s {|pm    if (yDir == "down") {
B1i$I0?D"P       yPos = yPos + BallSpeed;?u?5Ah(S t:V
      }BkF5F8T
   else if (yDir == "up") {
}Qz5flI1Z       yPos = yPos - BallSpeed;
hzJ}3G.j N U       }
0]3d#qX7P    else {r]I5~~ BW,E;I
      yPos = yPos;
v D'o/~%Z6Dh/X       }
7|E?.K"l;by7n9M    }
.B2tM#}k]Q AhQ,@9If+xv v%uf
function hidetext(){d7n&Eb'T'qz,O
if (document.all)
M'@*o.`(H!n supertext.style.visibility="hidden"*kV(R$k#QdW
else if (document.layers)*w-w0E1A;M8Gf'~7`(Q
document.supertext.visibility="hide"
*{ U'n2Fi[{!`!] b clearTimeout(animatetext)x1NG8Qse(py
}?R%B \)i O.OP)~

&?1p2x(T#?+r)A1Ba if (document.all||document.layers){
I"x,@4A5v document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')3?0Q4gW$eG
window.onload = initializeBall;
8S,E fk$I#U*y A window.onresize = new Function("window.location.reload()");
as$Zp.| }
_^1FYV pJ
{ B.Y*h*kLI </script>

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


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