捌玖网络工作室's Archiver

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

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

<style type="text/css">
(d2xZ.L;J"c'z #supertext {
B$lMXA!}g6s position:absolute;miX4N^1d3i
left:0;
ER9e Nw*fBT x top:0;1^JFlQo
visibility:hide; n!f OBq!K
visibility:hidden;p`6Fti I tt
}j EZp9|"\
</style>
&kS`a t&eY&b <script language="JavaScript1.2">
^ROo W m(r.q <!-- 改变下的字体的大小。颜色-->
k1H e;NF,] var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>':D2?(x{8KP\ Z&M
var hidetimer='';
:K.v/X8Z?? <!-- 改变下的弹跳速度-->MH j:TA"I#bu p8K!oH7A
var BallSpeed = 20;(c/_.A {h%M5IH
var contentWidth;1h4W1k$JL
var contentHeight;
1[J9xJ3{^H5\ var maxBallSpeed = 50;QzS{'l"M
:~f B7Z*n U8C

;`7`'ZL7D,\P8K-_,C1| var xMax;-p)lv [Q9N/X L-fp
var yMax;*aQ oudxN
var xPos = 0;
'gw+e*\L%Tb var yPos = 0;
;iuU8lBG'Dm var xDir = 'right';
!j&TXjjp^Q var yDir = 'down';7Cewv3S/d
var superballRunning = true;
J4Os^o5_ var tempBallSpeed;
3{;R#XVF"N&WJ var currentBallSrc;
SW8lY_9Bdw9g var newXDir;9F"f |&[*h
var newYDir;p)J8|.at~)WG8w

Kh*{%J'Wsu function initializeBall() {
`BR(A.E]2b    if (document.all) { s(t1U] _zM
      xMax = document.body.clientWidthKy6@ T-~(u
      yMax = document.body.clientHeight
4E ] U7MG;L&o(g       document.all("supertext").style.visibility = "visible"; aqQ5c;{ tUKJ)A
      contentWidth=supertext.offsetWidth
I/_6d~ }r`l8B       contentHeight=supertext.offsetHeight^ | s}| S
      }
u*o5J&]r#l%U fN    else if (document.layers) {
,X5M6J.Q p1P$P'E x/Q       xMax = window.innerWidth;
QZ*sC}q.G Y       yMax = window.innerHeight;~hv0t[S
      contentWidth=document.supertext.document.width
gz&mtE+] {`X       contentHeight=document.supertext.document.height
%P U nd.qp       document.layers["supertext"].visibility = "show";_#jQ7m OM
      }
0nvj&B3]$J)v    setTimeout('moveBall()',400);{pWo|5{!c
   if (hidetimer!='')8[zL(]-M|2H
   setTimeout("hidetext()",hidetimer)YADg6[ O
   })D/GG)]%d {t

:|2R ]"[~1^ K-U y2Q function moveBall() {
GL$V$g%P8jJ7SV3B    if (superballRunning == true) {0EG6s]6`rg;k[9z8|
      calculatePosition();/m'Omh_)v[
      if (document.all) {
4d@DA%F){          document.all("supertext").style.left = xPos + document.body.scrollLeft;
8TmW+u(t(t"C6S"w;K          document.all("supertext").style.top = yPos + document.body.scrollTop;XXG/t$N"gA-o#K
         }$i)^_5@*xY
      else if (document.layers) {
!T9k yu6]C/v          document.layers["supertext"].left = xPos + pageXOffset;
_j0B5o$tz7F          document.layers["supertext"].top = yPos + pageYOffset;
W_cMBj          }
w#i W#T0z}$P       animatetext=setTimeout('moveBall()',20);
E:x+lB}CS"L%S       }
&r9x{,o7cI    }7w0Zd O4Q X1O

GiNK!uI c-U2bpq function calculatePosition() {
&d4O nU+W;F4}([    if (xDir == "right") {
&C {1W? t |T(Z       if (xPos > (xMax - contentWidth - BallSpeed)) {
3BKzd t` b U b`          xDir = "left";:FKW!U7v$_Y+iY
         }
k8W3V|y)Kn       }
a#WU(o[    else if (xDir == "left") {
l_~l1sY       if (xPos < (0 + BallSpeed)) {
.vY1A9[$KHs(B          xDir = "right";^*_Vcn3Xw5B
         }3]7DG8Ad eE_
      }2N1\ J5d&X)yAG~
   if (yDir == "down") {
{_7M.y[|7I;h       if (yPos > (yMax - contentHeight - BallSpeed)) {c8zn5@1d%R,Jy.I
         yDir = "up";
n}1]#Fg n/^1^          }x%{w-ZW G.@y
      }(BKg `7B}0K9pvIHp
   else if (yDir == "up") {a.r.Cga
      if (yPos < (0 + BallSpeed)) {
(y zO%L i3N:K-?:?          yDir = "down";
(_7~H-nY3Y w8K+x%j          }
u^rfK5gx?B6R       }Bv Z:AM
   if (xDir == "right") {EcR2W&_U
      xPos = xPos + BallSpeed;"| faP_O
      }ZdL3H(s _
   else if (xDir == "left") {k,YXm8S7D
      xPos = xPos - BallSpeed;}m\-vO0K}
      }5uD)A$c'M]#y
   else {u#F@P/v'o:n
      xPos = xPos;
Ov)q7B oWlC       }#S$^/{#f]"qc
   if (yDir == "down") {;Y3nQR1mQe mz
      yPos = yPos + BallSpeed;
b-M0SPo6M.^G,Z       }
{;c WW d"y%_    else if (yDir == "up") {3RA QDdx6v)zC!g4E
      yPos = yPos - BallSpeed;Bt)usJ
      }
I8zZ^^d    else {
i;F%I4bK       yPos = yPos;7gTD N Kb8p:^
      }
FRg!GNBN h    }
4X0}/Jl+YG (T d9y:d u t$v
function hidetext(){
.Ahsdx if (document.all)re!q4m9YA(~
supertext.style.visibility="hidden"'^-[5MLwL
else if (document.layers)
^E(_C;b:[ document.supertext.visibility="hide"
#wd{ T,vY#H clearTimeout(animatetext)
0D2w_ yru!n1S9o{ }O5q$pJ `~/b8G9y;LzDI7U

'^+j:k*iW.Z if (document.all||document.layers){5ToQ)_ RzF
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')1sFm5t { }d
window.onload = initializeBall;
wa/Tx%g#x;|+Y window.onresize = new Function("window.location.reload()");
4rsST:UpP }
G?H,c6o7wJ9q
WF$D+}G(v5Ad </script>

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


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