捌玖网络工作室's Archiver

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

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

<style type="text/css">
8V[l'b"B!Ja #supertext {S(qV |$XEf"xsdz
position:absolute;
S)~9N#yd left:0;
] SFqV_m j6}0`9Q5j top:0;ub ?C+^&_$U#b
visibility:hide;X~S1S nLb/vYt
visibility:hidden;
as5Ez2A(np }
{v uI O </style>z2[7RS {up!M9E`
<script language="JavaScript1.2">9OJPV\jAH3pG
<!-- 改变下的字体的大小。颜色-->
!p@en\"x var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'gZ9AA/E~S^
var hidetimer='';8mZS]q#Z2e
<!-- 改变下的弹跳速度-->
"Q;e&X u\:zy%w2@'t var BallSpeed = 20;o&W8Nx?pP
var contentWidth;
Y!A CHo var contentHeight;/S&b'[Lg@O;Hr
var maxBallSpeed = 50;
m!Nyv8qx
8zKen'{'v *HY x;l#F'W+t8~
var xMax;
WHSDwZ7\:Vm var yMax;
7Z [-?XC%r-v var xPos = 0;)@;B:^0F+DC
var yPos = 0; N_/{2R:ZQ
var xDir = 'right';
T(ec2U&U)\&J%Z var yDir = 'down';
I#l[Ib.U2o var superballRunning = true;
&eT6T2^qoX['u var tempBallSpeed;
6kz5?,y\;~@-Z var currentBallSrc;
{bJn TE var newXDir;){~z5m;O*FY"WR
var newYDir;
L5QPG?/R wL
nn;~'Rh7zD function initializeBall() {k;sY2QoW;J
   if (document.all) {@7QN1wSL
      xMax = document.body.clientWidth+Y3K&k6Z%a%H
      yMax = document.body.clientHeighteO(I,m8wI,z W]J
      document.all("supertext").style.visibility = "visible";
,O(U"? QHU.g       contentWidth=supertext.offsetWidthc IJ'o2b]&GG
      contentHeight=supertext.offsetHeight
J5ayRh(L%{       }8q+qu]n6z w&_l
   else if (document.layers) { t&f5Ay _Re#W
      xMax = window.innerWidth;
Ma'jtP-\b'v Es5^       yMax = window.innerHeight; Bd1Y*M4iN(t a(J t
      contentWidth=document.supertext.document.width(|4~'H7W&@,h
      contentHeight=document.supertext.document.height(Y C \3V4q6}J
      document.layers["supertext"].visibility = "show";
T ? ~N3V7?G       } n5FN3pTJF
   setTimeout('moveBall()',400);
D;w"wb#h8]O.F    if (hidetimer!='')
-QJz,Y)E&f7Di    setTimeout("hidetext()",hidetimer)
9o%G;x%F4ol7j3HD1[    }a]J;m `5IU

Cx&[x8}8o function moveBall() {
vz4R6\ T    if (superballRunning == true) {
7D a+UYu.o\8x       calculatePosition();
n I$g:? r y       if (document.all) {
5c| FC)W$Pf%B          document.all("supertext").style.left = xPos + document.body.scrollLeft;
u']JQ0M$z([p)F          document.all("supertext").style.top = yPos + document.body.scrollTop;
%m3y&|S?bV          }
k2Cp8{2or@PAs       else if (document.layers) {
"L.p;p1t,vGsj?          document.layers["supertext"].left = xPos + pageXOffset;W-|Nb:T/f&}4azMV"W B
         document.layers["supertext"].top = yPos + pageYOffset;
)X;K5P'f5ept          }
9A4MR ]W       animatetext=setTimeout('moveBall()',20);
Q$R @8H:m       }
t4SH.qU5a    }$R$PN3q*]

}}4Z*k K(U function calculatePosition() { ?3bk ?'V(|-|
   if (xDir == "right") {G2AO~;oIJ
      if (xPos > (xMax - contentWidth - BallSpeed)) {
Q,`)GR"U          xDir = "left";L:P pR#D5z9`
         }
Z7YH adFL"RJ.v       }U g@U5n&fObF'M MDV
   else if (xDir == "left") {
&_|VE;oKT&l]       if (xPos < (0 + BallSpeed)) {
E!? h9Z&S GZz          xDir = "right";bYT2pRX S*Z d
         }pM[ dRSN
      }
^(F-hO\wE ]2s[%t2\    if (yDir == "down") {
/j KE+N6D f-E       if (yPos > (yMax - contentHeight - BallSpeed)) {
!I/Z i!j!y N/t          yDir = "up";
F {7_w+H*is          }
EmfKl       } z.[+Dg p}i/c-r@
   else if (yDir == "up") {
9J$Q|v1B       if (yPos < (0 + BallSpeed)) {
)}c"d5V1r5d          yDir = "down";
1oz P$I!lc*E \f          }
#uE.Sl Yy3tFt       }
L1? Q-aN4D1U    if (xDir == "right") {
l;MK*d c:~)]       xPos = xPos + BallSpeed;
w!yK&I KGc*Q!J       }{T4`nB%bV
   else if (xDir == "left") {
Ni3o^L%h1K       xPos = xPos - BallSpeed;'\ R[/Gg
      }
h@ S~N$lvv    else {-Z5j w6uw cc
      xPos = xPos;8KC%K0q"W
      }i q(t0j2jP cP9B
   if (yDir == "down") {U_5Ff%y)Q \ m
      yPos = yPos + BallSpeed;
&QEje7F5yT       }
],K!B4hb6Qno8dN    else if (yDir == "up") {
$q t ?{djF]-C       yPos = yPos - BallSpeed;
Q+M[/D*|A dH       } j1sYQM)Kc
   else {
U5c8NP+L2z q       yPos = yPos;\bEDh:qjo
      }
"H5|Tnw qcI    }.b4kZ"v"uZY

5jwt+jr"J+~8S_"Q function hidetext(){ CSa7g u~_Bm
if (document.all)
}L,G JI,}lw~ supertext.style.visibility="hidden"(K Vl;m]*TTY
else if (document.layers)x,l a4na!yn7b"X1t(_
document.supertext.visibility="hide"
G {o4o9x A k clearTimeout(animatetext)i:E"SM6U^(~5i0e
}
b5[J&U9G J %|&i$NO n
if (document.all||document.layers){i8n{O/y~%dqO G
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
2c-a&b}f/\1Su2C window.onload = initializeBall;
v$~3R-S[ window.onresize = new Function("window.location.reload()");
J|@o3w~3E }8RH(P0at-Nb
7i2XU|C%]B
</script>

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


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