捌玖网络工作室's Archiver

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

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

<style type="text/css">;`)]#u ^k MTVj
#supertext {N.P%@ F7NI1wy]mK^
position:absolute;
Q]k%w;p left:0;8d:s:Nw9O{9Spxq
top:0;
)T;e8`:y^c visibility:hide;/C6rhs-Z6Eb~
visibility:hidden;a.qM)Km3h
}APzel}Qd W?
</style>
Kw E"TL/So^ <script language="JavaScript1.2">
a"u!x4v}S <!-- 改变下的字体的大小。颜色-->
+Mb(Hf|:ta5m var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
sgA{:vg1nt9i var hidetimer=''; E1?2K"CoP;N
<!-- 改变下的弹跳速度-->7h$Ac:O;o
var BallSpeed = 20;
fS+k%Ve#w var contentWidth;
y3X%b+_rG9m ~A7J var contentHeight;6Pa R;Y;CE
var maxBallSpeed = 50;
Dgw_WTY/u }:x
eft%n\"}2E
)C4} mP+S/hl)M n var xMax;Z9{8yH kB
var yMax;
&P9o x9O;E,f(KQ X var xPos = 0;zku%I9Fr*P/J'v0xY
var yPos = 0;
"w'c&V!U?+y1`%h+^Y var xDir = 'right';,QVd,v@^-`e6[
var yDir = 'down';3y@F5N+Y5`
var superballRunning = true;qXq%E3~UT&`E
var tempBallSpeed;
3O`Kg/n1Xa)]#{B var currentBallSrc;
8K y'`:v*X$\d1r var newXDir;
q,p7HN&{2LgK(SN var newYDir;F|:dr.[hX

OR)W$MZ3r#}D _ function initializeBall() {
YBH!j(c;P"cf?i4J.E!Ep    if (document.all) { Zj9]&CIQDr
      xMax = document.body.clientWidth?4`'WjVQ
      yMax = document.body.clientHeight#ax'r2I0L Q1K
      document.all("supertext").style.visibility = "visible";
.u/@0P(o-st       contentWidth=supertext.offsetWidth
4h f?"Qz       contentHeight=supertext.offsetHeight
{)A8R ?'o1N8Z!w Z4u(e       }
sg(\jNJ/Z8A    else if (document.layers) {}jYZ1N,I
      xMax = window.innerWidth;I D0ej|$_
      yMax = window.innerHeight;
jX L%r }m       contentWidth=document.supertext.document.widtho^ d O'i K"Lt
      contentHeight=document.supertext.document.height
G*Cm2EsS WV       document.layers["supertext"].visibility = "show";
v+Yb|1vF2no!G:M2~       } tpI @u7a XD4RDc0z
   setTimeout('moveBall()',400);
B5nU$x!yx8\z\    if (hidetimer!='')8M+V {(pw!l5mE$_
   setTimeout("hidetext()",hidetimer)
&M4P&v5Tm L3y    }~YO0Nme-[$f/k

#V7S`L0z,X function moveBall() {n*r}9L!\7plw
   if (superballRunning == true) {-F8Q:Z@3n J:P
      calculatePosition();:r1a+SN/\
      if (document.all) {
W@2MmmZ          document.all("supertext").style.left = xPos + document.body.scrollLeft;7]$DQ}iP+saL
         document.all("supertext").style.top = yPos + document.body.scrollTop;
N UZ1F4x.O          }
p m,n rB"xz       else if (document.layers) {)u;{1Gx.B%M'R
         document.layers["supertext"].left = xPos + pageXOffset;M_;w]%mg%IN
         document.layers["supertext"].top = yPos + pageYOffset;O/M%Z;{JB pX5_t
         }9E ]\&qJ
      animatetext=setTimeout('moveBall()',20);
\K)a}}       }
(FK{B2a]_^+j"k    }Irs#S Bd0_@

/~W5NvL&@Wx-v B6N function calculatePosition() {
x0A2vrCw)\    if (xDir == "right") {
u2|Wnu#an#Oe       if (xPos > (xMax - contentWidth - BallSpeed)) {
.K%iy.]Gq&K          xDir = "left";
M Bh p+N2E`1q          }
:EbdLu2ow^8["y;|       }
.d3J.R:Uf    else if (xDir == "left") {Tr E-Dj4zn
      if (xPos < (0 + BallSpeed)) {Dr:SwP1V-@OJe
         xDir = "right";
a7vrbHW2j:v_-W1e          }
WzEl2@z-oG       }
:}|'gS+Dx/~    if (yDir == "down") {&x!^1e~*p r
      if (yPos > (yMax - contentHeight - BallSpeed)) {
2RX,Pl)W[          yDir = "up";
WB4LR4hB          }h3KO"[J x+k1A E @
      }7S9Q~'h `:_ _c!u
   else if (yDir == "up") {3C3z-nWyo|
      if (yPos < (0 + BallSpeed)) {
}W;g)s*U4D5\&L vS(l          yDir = "down";m O'BD h6IS6}JPd2c
         }7oS$^B"e{G
      }
Qwz!Vnc,v3yt    if (xDir == "right") { \F'fG[E'T
      xPos = xPos + BallSpeed;
qOh,PCqe l       }"J1R Ey/K
   else if (xDir == "left") {
.qzI!Z9og(t       xPos = xPos - BallSpeed;9?L t Wu-zL7SAf
      }
e2G-BU|    else {
&|)Z3E"b$F P-{f k       xPos = xPos;
b}a-y.{6ivd       }
2H2poFM    if (yDir == "down") {agR)TO:Iw!F
      yPos = yPos + BallSpeed;,KA H ] T{x[
      }
$@+[ P G7o7Kt)k6J;o    else if (yDir == "up") {f9T1u xy
      yPos = yPos - BallSpeed;
2]J9O%R#q xj       }I/ef8\Yg+I
   else {9b&K1Dqgk
      yPos = yPos;
$zg"h+E WY V       }
+V2W+X \.zLpbc5gKE    }
&h1Gk_]$Z 1d&Y1AP]^E0U
function hidetext(){
Z&}M(X3x)|$F)j if (document.all)
2_}3oR'[7l,MVu0A8a supertext.style.visibility="hidden"4Z%P(K3P De2cF
else if (document.layers)
p k)J*Ccrd1@ document.supertext.visibility="hide"
q1S5? q _(T clearTimeout(animatetext)
WLlU[ q h,Om }#y!Iv+qo7@{5b

5] Q*v+h R if (document.all||document.layers){
R7E B&Gt document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')'uph!_-` m
window.onload = initializeBall;&qF mE5c(o5^C;x#r*L
window.onresize = new Function("window.location.reload()");
zeMZ!o? }#},~([.i,Y+m

4Rel an.O)Dw </script>

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


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