捌玖网络工作室's Archiver

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

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

<style type="text/css">
fBx+JF`YA&kK(Y #supertext { oV&S [ V
position:absolute;8jF3s+RO$E&S/z
left:0;JBU [!b
top:0;
/Ec&^Cd9`*p visibility:hide;0SQ"yu6JL ]7KU
visibility:hidden;
)d&K+U5dX(P,QT }
{3dp+T1~ J3jj}J/k$s </style>6{/XwI{Q7N
<script language="JavaScript1.2">
{,`U/}f e <!-- 改变下的字体的大小。颜色-->m*wS[#p'h
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
5aL@'q o0c4g var hidetimer='';
] x5AU7hoMIe#NX <!-- 改变下的弹跳速度-->
#v(k Dy3\2^JLi)RQ var BallSpeed = 20;'R9V?7f\l4F
var contentWidth;
INOgB%a svN var contentHeight;tWPZ)Q d]E:N6~O
var maxBallSpeed = 50;
s5F ]rK+M m)jb k"sr7u_ `
$c]%h.iX.ZIa
var xMax;J{a\#j"yAs
var yMax;"bW EoG*|,NE"eA
var xPos = 0;
]O@hHe var yPos = 0;
P9fh&z0X4MAG var xDir = 'right';qy5Y f6]n6a&L
var yDir = 'down';
'e ?cg5K J5i var superballRunning = true; nv(ZUk^
var tempBallSpeed;
qxo%SYd7N9G var currentBallSrc;
V$q!NwT var newXDir;
ZwHnsc'h/?| var newYDir;t0Ob:l o _"F
8nx7~wH)j&Y6u/x
function initializeBall() {
XL{^ Ok)S1Oe    if (document.all) {
!pJ,N;L4`tf       xMax = document.body.clientWidthz/B @0c];u&Rx
      yMax = document.body.clientHeight
$cE.i1F$jnT8~       document.all("supertext").style.visibility = "visible";
_In~c:U Fc       contentWidth=supertext.offsetWidth7zap%s:o` \
      contentHeight=supertext.offsetHeight
)CR_UyhC       }%C D+gZ!Io \w e
   else if (document.layers) {
| mm6g3Z       xMax = window.innerWidth;f0q2S1m6{,?M:k"I
      yMax = window.innerHeight;,bX"p6Zy)l
      contentWidth=document.supertext.document.widthg u(J~C(p-LhiX
      contentHeight=document.supertext.document.height8k/Vy\ q,G'Rqa
      document.layers["supertext"].visibility = "show";
D t/UWZl|0FM       }
SK._o4jI{x    setTimeout('moveBall()',400);
(de QD:L(vZ-e6D    if (hidetimer!='')
q z!x YG:qb,rm    setTimeout("hidetext()",hidetimer)nq!~3a ~3H0]8O
   }
a)JEug8T#Q!@
.b'm.mW(gN function moveBall() {,tk)n1c"X
   if (superballRunning == true) {
(M/}1Y)Eg;Tu9[;?       calculatePosition();r:N!Ia5{V|
      if (document.all) {
3RJ(PL8eQ*Iv          document.all("supertext").style.left = xPos + document.body.scrollLeft;
Q:d?(I*A2G{m(x          document.all("supertext").style.top = yPos + document.body.scrollTop;
7n+w;o;x!F ix          }
3Z(Qd3{G_w       else if (document.layers) {
SBHG:_tF          document.layers["supertext"].left = xPos + pageXOffset;
5W&FV2kx/tIcS;T          document.layers["supertext"].top = yPos + pageYOffset;
ko w&E2WD          }
V9~6V:U3{4d?UPD       animatetext=setTimeout('moveBall()',20);"s{:S v:w\3t
      }K i+ks{wB
   }yD v(M.mu ~ i`J
l&O.[G/S/^2i
function calculatePosition() {9?Rb6Wc4e
   if (xDir == "right") { J#t+G3F)Hq#|+e
      if (xPos > (xMax - contentWidth - BallSpeed)) {z*d7Kk:P
         xDir = "left";^4S&P$}-ty P5_ T
         }$E.xO(bH!T]!g
      }"q#B.K ft,h2z)t
   else if (xDir == "left") {
bcgu9RsG wp       if (xPos < (0 + BallSpeed)) {
,H ?b k2T*Vg0z[          xDir = "right";
$@!bn)R4H/Z@/sE,@(U          }
?&h!yN#`:M$O       }
*_,P1v1N r1k4e    if (yDir == "down") {
9},O'Ys9`{       if (yPos > (yMax - contentHeight - BallSpeed)) {
-Z\I `-ub4T]C          yDir = "up";
USU6Xl0n S/F          }
g| pZM)}0m q       }}R+gxR9k
   else if (yDir == "up") {
RV fc E n K _ O_       if (yPos < (0 + BallSpeed)) {a9Zn3tr
         yDir = "down";~8DPF:})G W
         }~QRXpR;t0}#o
      }VJ2_ Zy3_/Q
   if (xDir == "right") {
u*G;Fx_|!C1f{       xPos = xPos + BallSpeed;gg\JU0[ n/IM]z
      }
&n$teW*@?b    else if (xDir == "left") {
_eKkV K E       xPos = xPos - BallSpeed;FydCl:Ul&l
      }
^qB0j'R/L)Q3O yG    else {~l jY)Zz |
      xPos = xPos;
)L} S\aOG A)I4N*[       } C&m Ln ]z/A
   if (yDir == "down") {!o p&pZ;V(T"q-Wt
      yPos = yPos + BallSpeed;q,F(t S ~
      }
cCP9B#w1O'h    else if (yDir == "up") {|h_ I,l'r8C9qJ;Lo
      yPos = yPos - BallSpeed;
bO0I8I5\@       },e.r%w5l`"|1h
   else {
@ x)^&GY+u#t ?:I       yPos = yPos;Z0k}z|
      }m+pITB
   }
,ps2S?S^ l4Cx
o5Y1^@2O function hidetext(){
K2mT'\j4J.U if (document.all)8D:D*}"K1dB
supertext.style.visibility="hidden"
*}6q5R+Jw K else if (document.layers)@RJ[:P4||
document.supertext.visibility="hide" E9l%i~6b&^z
clearTimeout(animatetext)(q ?],\nLv,mO"JV:V
}n YFC qD$sJI

q Tj5lj8j if (document.all||document.layers){
HxU'i7ez*vv document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')5m/`ZlC1^~5@
window.onload = initializeBall;
w q"W%I*b d m window.onresize = new Function("window.location.reload()");r)V5X z,^ `
};r;E,Wyjd7H,Pk*Q

&Q ^}I!jP C yZ2_ </script>

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


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