捌玖网络工作室's Archiver

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

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

<style type="text/css">
dC_ hu0^8w #supertext {-o VuMe
position:absolute;v4Qp o*p1S([
left:0;
F#s E HQ%h l top:0;j/S!FT"M.ZO,c
visibility:hide;
[y.j:lczs g visibility:hidden;}6Q t-Ud
}4^.S)},r(Er
</style>OZ Nf%GSh&\e0P
<script language="JavaScript1.2">^|%N2T7nL0fb([
<!-- 改变下的字体的大小。颜色-->
)h^5^4jS%Eq}"U2] var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' yaab:n$]1N/r%@
var hidetimer='';w5q}#K_;J!`9Q sr-k-R
<!-- 改变下的弹跳速度-->
Qr | e.Hc^6R var BallSpeed = 20;fo S4V:l%K
var contentWidth;
+P)ij0CCq'h%Z var contentHeight;,T+Z c"{8i4q
var maxBallSpeed = 50;
%O c-]o2K}4I&[I :n,pE|Uc

6itkQ+a pm var xMax;t!Cp6r6i%t+xsx
var yMax;O6N3y;H:j,u
var xPos = 0;%q3L!fJr
var yPos = 0;
l"V@3B8Jd var xDir = 'right';
!OQM^pAF var yDir = 'down';
ma!J T.w6?EQ var superballRunning = true;/x2qZ,DUz
var tempBallSpeed;
o:j4eS/J var currentBallSrc;t-J(g R9U5Y
var newXDir; e l/y7zb9iQ
var newYDir;
-h~%@+H#G J
dKN UY2T(Q j function initializeBall() {)r,Vi)pa'QO,}2n
   if (document.all) {Ky$Uv%S0?~
      xMax = document.body.clientWidth
o m/} e:e       yMax = document.body.clientHeight(P/ePmu(P`$o$e
      document.all("supertext").style.visibility = "visible";
g0hG@ [G       contentWidth=supertext.offsetWidthg@2JE5rtX
      contentHeight=supertext.offsetHeightL;F?{pGK%~zA
      }
(l @(xi@d1h    else if (document.layers) {9\'\keQ1cm bq
      xMax = window.innerWidth;7EPk%Q6S)|$g^
      yMax = window.innerHeight;
!KQO#E&n(W%ms       contentWidth=document.supertext.document.width
3~OG$x t?a`"z+et       contentHeight=document.supertext.document.height V,NZ G&l,\
      document.layers["supertext"].visibility = "show";
L[.A!P|e4A6BG(Cu       }
A8kB{`!P9q-w2B    setTimeout('moveBall()',400);-kT'hHWa3{_8T
   if (hidetimer!='')
OzG/o&F g l&Bh    setTimeout("hidetext()",hidetimer)
7u7P_Es:J(m    }
5vC;U-S'I)K {e4aY3w \Z T
function moveBall() {
bv7{gH&A9uvX:H[    if (superballRunning == true) {
UL%yGs ?FO#ToE       calculatePosition();#R Ep)S)_
      if (document.all) {ij)L"a I"B w0RG
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
Pk%W3ni*]Um}S          document.all("supertext").style.top = yPos + document.body.scrollTop;
5P3pd:f:|~*I%d)c?P          }}I9x5L(C9@F/v:`^]
      else if (document.layers) {
.v%D`O&a%n0D[%H E4i%Aa          document.layers["supertext"].left = xPos + pageXOffset; Z(Jb5jUD2~
         document.layers["supertext"].top = yPos + pageYOffset; lRl T.WWe`.EP
         }
;@ [z#YC R(v       animatetext=setTimeout('moveBall()',20);e1qkHX |
      }{%J:V4[6W
   }k C,\)Y*T#A

'^(\;DyZg function calculatePosition() { l ?1n5X,h+rXE&Q
   if (xDir == "right") {+{iqUdX,N
      if (xPos > (xMax - contentWidth - BallSpeed)) {
3q[r?XY j_oq]          xDir = "left";
r!A!M{Rtm.h          }
/x?{)Hn x6y~       }
\5]0VBW5@    else if (xDir == "left") {
6Hjdp5H)G`b |       if (xPos < (0 + BallSpeed)) {$jc8i*}t(E*h
         xDir = "right";9RScW:d-cP;T
         }
,j}TG!q]r1h9Y       }L+J5qj4C'[2aR
   if (yDir == "down") {
JgG)h[ta       if (yPos > (yMax - contentHeight - BallSpeed)) {ylejX[#e
         yDir = "up";&T?4r7]0@e
         }
Wn4d9P(S L W       }Z.i6LKg%n'Y7o
   else if (yDir == "up") { GhS3r-i1zM*~dk
      if (yPos < (0 + BallSpeed)) {
#D Hv:l)T7L/W-PwJC'\          yDir = "down";$td"R!y s0h7AR ^
         }
2j3zBI(MW|K#s       }
7qr4fR*Vo    if (xDir == "right") {4RA8Q]-ki8v6JYY
      xPos = xPos + BallSpeed;
3R${ o\X       }&?;HdLSp6G,nxB
   else if (xDir == "left") {
xRzCU.~ M*J       xPos = xPos - BallSpeed;.N T/ODcZQ2B
      } o0G4~&D] bG B
   else {
*@(l|/q%G$Y       xPos = xPos;
`7x*j)Y ^ t       }
o` [Y}:?#W'~3Y s2B    if (yDir == "down") {
%M'`*w1zd&nef       yPos = yPos + BallSpeed;#NIp|M!i
      }
Mw}v:b!]%qqa    else if (yDir == "up") {
!c$k6w!c2U8F2u Z k       yPos = yPos - BallSpeed;#A,fs,Y\ X8aQ
      }
(NB Y)^8CKA`    else {7xf7R} f+KB-y
      yPos = yPos;
D:R0r z zE8l       }
zuu P qB6TR    }t JMSsAcS
9[6\6R%NPbRizb{
function hidetext(){P7`f O }
if (document.all)
0K4Bm'Z Q.u4?,C#OL supertext.style.visibility="hidden"
4y$bS.j"LR pR o else if (document.layers)
Z2h;M?-E`!NqOWx document.supertext.visibility="hide"Dp&J?/KH.N"F
clearTimeout(animatetext)X \K]6z"z+X
}n(} B K5P
W.v cp'T ]S{
if (document.all||document.layers){}eH%`,T/Y%Y3j`
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
Yv JrU(c*K window.onload = initializeBall; y+Y(Z cf,b)c
window.onresize = new Function("window.location.reload()");
A-Y!D1@H? }
ymI;s1]D \Ko)YT$g-U\'E
</script>

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


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