捌玖网络工作室's Archiver

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

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

<style type="text/css">G} S&}N
#supertext {n*Dfjx-l'n1GQR
position:absolute; [2K"Y \f"i+v%MX2h M
left:0;,y Dp3[7C6dH
top:0;S"n:d1Ulw
visibility:hide;
1~ y |5O0uEmy visibility:hidden;5APr.} Ln;B'q
}
8aRkRLzL </style>
Qg$x|Vl.c-d } <script language="JavaScript1.2">
%^+AG2J[*r} <!-- 改变下的字体的大小。颜色-->
0go6T+Vug q var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>' Rcs3H4e?6a
var hidetimer='';\#P&m/nB
<!-- 改变下的弹跳速度-->
Kad/cf)S LP0LE var BallSpeed = 20;
;g1q/R5jP|8|DV var contentWidth;
x1~2}g3aD8U var contentHeight;9Mk,A!}/}$RR"v}
var maxBallSpeed = 50;Yr"@mT {:fr
K { Xv ]-KJt
EI"\ eU@u$B
var xMax;
U(M,q|6i0t var yMax; vd3cX*m[ a&h
var xPos = 0;1f,R_q;l]D
var yPos = 0;xE0z"^f*q
var xDir = 'right';
1KS%fs4P*e[r var yDir = 'down';(qWj"}|Y7a
var superballRunning = true;` f S] y
var tempBallSpeed;
I)j K%[i1_ var currentBallSrc;([o?@}sQS$_9o$x
var newXDir;D-V9Z/Q:X vP
var newYDir;Y w\2Lj([[ ?"d

B KU._#rJ-Z"V function initializeBall() {{m.f\`8j
   if (document.all) {
xX R0v4~ u&X5P_       xMax = document.body.clientWidth
p,cZ/pn       yMax = document.body.clientHeight
1gK$P,{,J.mp2Q       document.all("supertext").style.visibility = "visible";&O#borB4i(w)u
      contentWidth=supertext.offsetWidth
].I Og mK       contentHeight=supertext.offsetHeight
nStH)l!l*w po!Y       }
(I}E%F*l Q-Z2Os5d2z    else if (document.layers) {1?F2AU#b*`t6U4E#Y
      xMax = window.innerWidth; ] K)R;U^[c&Eu
      yMax = window.innerHeight;$f1_S)i]5f
      contentWidth=document.supertext.document.width
5ghM2iy$ZG$Z       contentHeight=document.supertext.document.heightf;TR&[A!u
      document.layers["supertext"].visibility = "show";5[s*c3y*a&U(zafc
      }C(y7y'_7i+e K
   setTimeout('moveBall()',400);3l R7yC?iNA
   if (hidetimer!='')7e*B3j#p#Y&r0rG,E.[r
   setTimeout("hidetext()",hidetimer)
T9~G&c+yV#Zs    }
+M/p;o.{8AM eH+n
TfMhp_ function moveBall() { z+SgIInu
   if (superballRunning == true) {0Zj g"y'C&U6HQL;{Y
      calculatePosition();
H9^[JP sC       if (document.all) {-Jh8Sb0E
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
E9ljGt d          document.all("supertext").style.top = yPos + document.body.scrollTop;
cHB%baS!Pm          }}"@,M;K'R
      else if (document.layers) {2GA&eZ;w
         document.layers["supertext"].left = xPos + pageXOffset;
}joK"jq2x-p          document.layers["supertext"].top = yPos + pageYOffset;g+S'ZSam!n%r
         }7q\-F(@q"y [
      animatetext=setTimeout('moveBall()',20);k:mCs$Gs;n
      }fw-sJaynB/|
   }PUkp0^2p6W
5B6\/RR.K!kg
function calculatePosition() {
&m1H/~&V SR1V    if (xDir == "right") {,KEO.l$d j P]
      if (xPos > (xMax - contentWidth - BallSpeed)) {NtU2i'^jy-R
         xDir = "left";(~T9[-_H
         }
] k~/lq q       }
Xg[+M!G    else if (xDir == "left") { o,r4W(u4uk{y
      if (xPos < (0 + BallSpeed)) {
6j3a3HH-} pz          xDir = "right";
bjS @9TX c          }
X$A-}*Q1q-X%c-b |U/}       }
,v @.K~/sk&~    if (yDir == "down") {G7U0R9{x
      if (yPos > (yMax - contentHeight - BallSpeed)) {
'h4{bA ]qrG          yDir = "up";0g.}T#O8}
         }
b8^#l@.A.[Q%l`       }z^${;pi+Z
   else if (yDir == "up") {w6Ca,`D yK
      if (yPos < (0 + BallSpeed)) {E$i5U:Y {J5y
         yDir = "down";
p J t f N#iI-ez          }td!l%A HMH1F*|
      }~b8U%D%yr*L A&`:r
   if (xDir == "right") {p~:N;ALH
      xPos = xPos + BallSpeed;
}+PMd2Sc9g$U2C       }
L#vM.KO)^4{    else if (xDir == "left") {
4`g)sR8Z}S6a       xPos = xPos - BallSpeed;
1jG-A'DU GAR#P       }
H.ho.C ktLE    else {5m_xc mM[
      xPos = xPos;$e9@,?e&Uvn'Lemk
      }
c P v7[Ja\    if (yDir == "down") {$d^"K$@;zd(l
      yPos = yPos + BallSpeed;+xp%C:b M@-Q$w
      }XN Ih L4H!O5gk
   else if (yDir == "up") {
:h4hxXY|tq4w3Vf       yPos = yPos - BallSpeed;
U f4\7kn&~;I       }T/u,tY!m
   else {`2UlPd
      yPos = yPos;?@])_!g8Q"G"xK
      }
z#qUr,C;J-X    }3H5X/N6k(ir-w_

;~!P }Yd?Ln%`r function hidetext(){
X*ro-x d'M if (document.all)
'u)TtGFsG supertext.style.visibility="hidden"
R0sv.?#H else if (document.layers)(eP4Iq R `d$c/h
document.supertext.visibility="hide"
!XK+v:p yVbv clearTimeout(animatetext)8H6@/Z#R*E.G4p
}
,O G1_M)O'I;Vxv
$B V B-Eu%p-Cb if (document.all||document.layers){ DANNw3r)G(XL4NI
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')'H0O vg q,U,@~`
window.onload = initializeBall;
,? Ci6zs`*|R\v window.onresize = new Function("window.location.reload()");
!N6` ixW Q4O~ }
1hrftc
#f M.F5{*Roj'X:O$m </script>

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


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