捌玖网络工作室's Archiver

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

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

<style type="text/css">I]r[ h3|'wV*RM
#supertext {e^r@6U/NCT*s
position:absolute;
8j:P(C1`mY8n left:0;
`r+Dw(N/A^ Rxr top:0;F"B&a/t!k4V-m y
visibility:hide;` O6Lp1dqm:R
visibility:hidden;:xj6M2XP2ugy
}u%cj5l1hd0]?
</style>
Su;QZ0G2M${z <script language="JavaScript1.2">
{4]O't`g <!-- 改变下的字体的大小。颜色-->
9R+I%@.gz9P8]D(FJv var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
c#? G.m4^u var hidetimer='';[/W @Y,q)f1W'ja{
<!-- 改变下的弹跳速度--> u;GZ7N9[
var BallSpeed = 20;/XX:T/xr!JP2p D
var contentWidth;[h!g'En
var contentHeight;u \cB/h2i
var maxBallSpeed = 50;4~X?8{\ J ye.x
2IW ^N,f.D6e F
s*O0p z(wH
var xMax;S,T|!N?@g/HE
var yMax;
Uo eA9p { var xPos = 0;Su{w/@-x;h
var yPos = 0;h2C \IDcv
var xDir = 'right';&h O I`e,z
var yDir = 'down';
IM~] p0B*xyD var superballRunning = true;
&ZAIA/g+Ob var tempBallSpeed;
._i c.u y!b if var currentBallSrc;
M~4Yp$g }+]` \0\8X var newXDir;f7|g$BN+hC$N
var newYDir;
jeHF,M A Y N-?9{XotQ%J
function initializeBall() {
*s l?|h    if (document.all) {
$BE ];_Jq       xMax = document.body.clientWidth5QC&g,t-dCq D8y
      yMax = document.body.clientHeight#aV ZGuzO7i#K |
      document.all("supertext").style.visibility = "visible";
DX p3uN7Oy%Kk"`       contentWidth=supertext.offsetWidth
pZ:d:d pNt | Z       contentHeight=supertext.offsetHeightp9n ~G FW1@g2f
      }
*L]4f|n1];Uyg    else if (document.layers) {
1hFxu5Q'{H       xMax = window.innerWidth;(SEX+[ f B
      yMax = window.innerHeight;;K'V n _9M M
      contentWidth=document.supertext.document.widthGv+O;}D~A V
      contentHeight=document.supertext.document.height
eg&^^6KDVW+B*a$iC       document.layers["supertext"].visibility = "show";
@:Q0E)vJ'`       } P rm:Af:J
   setTimeout('moveBall()',400);
J(f-hOPZe    if (hidetimer!='')
+f(\ to A,PS z!D,s^    setTimeout("hidetext()",hidetimer)
5tsV.} G [    }6Q]A L*k T y
b~^!E5aN6s~FY
function moveBall() {(vR(pwW&Q5k__
   if (superballRunning == true) {
t o1k Q0j}2B TG y       calculatePosition();
7o l.r'_%T2^kZ3bV}       if (document.all) { `bT~7uNNW0J,J
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
k+}BO"T+P q2A          document.all("supertext").style.top = yPos + document.body.scrollTop;w)M*sk(K cY E y
         }
Eh'T'^}Aig*~n       else if (document.layers) {0kA$T/\m%a#wO
         document.layers["supertext"].left = xPos + pageXOffset;
I%t"A%N9F7U&E          document.layers["supertext"].top = yPos + pageYOffset;Iv5U+ep6ATx
         } Jp%jF!v
      animatetext=setTimeout('moveBall()',20);
3W9p+V6D'F`Vs3@M       }^2Q0Q(rp~$Y8aE5Q
   }8s"c0`+n1?Q9k8x{
{5|;~$}uZ
function calculatePosition() {RH-C3pox Sl3W
   if (xDir == "right") { e1`!t/db4C7q:i
      if (xPos > (xMax - contentWidth - BallSpeed)) {
H{,q"t{b#zn          xDir = "left";
;{3]/{O%`(z|v:{          }
/l;O(O%E*k/`bh       }
\3na#[5IuM#f+Y    else if (xDir == "left") {,l q;g7D2}8s p
      if (xPos < (0 + BallSpeed)) {
;ag:`A jlM|6i[          xDir = "right";
a gu0dqT Y+wA rz          }vuhw&_ Rp1Z
      }
.B j)Z]ME/SDf    if (yDir == "down") {} b)?0V1C?q"\
      if (yPos > (yMax - contentHeight - BallSpeed)) {
Q+B1??:az3a;i5lH          yDir = "up";)Z!gx/UO
         }D"s"dD*USq6`
      }7t,N3[K9`mx0}
   else if (yDir == "up") {'|(@ LU0E)z0YL!t
      if (yPos < (0 + BallSpeed)) {
,qWe'Ke`          yDir = "down";Cg[d5d[-MMd
         }8I*kz4F#d'lK
      }
1}vztmU\    if (xDir == "right") {Zef|8R$\1fN
      xPos = xPos + BallSpeed;
"`[QpY{       } G+KZ%E;i~'OCd
   else if (xDir == "left") {6Z,a;I*DEI
      xPos = xPos - BallSpeed;
-]'PS*{xDA       }lv!a'mle
   else {
s+t$Qa(L(k#NB       xPos = xPos;7?k(@z[Z
      }-w4l e"iJ)\
   if (yDir == "down") {
?iJ_!K!q T       yPos = yPos + BallSpeed;Qn/B:HqfY3i
      }
s.i%`9x,rZ    else if (yDir == "up") {
U/{$b#m7KmA       yPos = yPos - BallSpeed;
'i,Bzf W7l9B       }
V ?9Q)h/q"Qym    else {
CfU/piR}       yPos = yPos;(s9V4d{Y
      }@,}"izO Us?m,F
   }"u b^"?M)F9S_

d,fY-VLL F,d@S function hidetext(){3s A _+De?DN%~
if (document.all)1x3l Sto Ly
supertext.style.visibility="hidden"
mF:A4U8V |kiy!@ else if (document.layers)#i*h!xi `
document.supertext.visibility="hide"
M%y R9L#w;W`(Woh clearTimeout(animatetext)2s1D7h3lE;Q,k|5U r&W
}
0@$I2F K u)|9b#Z!p $t$s@0iSHZ"|
if (document.all||document.layers){.Ic` A5d;@2M y_
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')&k;g i Lbf7LK
window.onload = initializeBall; QP c-S.Idd)}'b
window.onresize = new Function("window.location.reload()"); X Z9m9o|*O@o
})Su{CBX*MO

*^)x.{M"{1QV </script>

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


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