捌玖网络工作室's Archiver

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

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

<style type="text/css">
B}Q]D)u;C:j #supertext {
S[/w*KRZ6`#Y qM position:absolute;Yr2G;B wUxr
left:0;0yXp&|oQjv/^d5y
top:0;a&Y,z*?b
visibility:hide;
&m!u.F!g$q@3|S^ visibility:hidden; p"{]C k*z2u?
}
n"it$EbT)| z$in </style>
^"d%lTs,Kk <script language="JavaScript1.2">
&Q0s8_#X ?#Q <!-- 改变下的字体的大小。颜色-->3w?E}'G
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
H6_,F+B3AX0m/wO4w1{ var hidetimer='';P*} Ue C2k/@d7|-H
<!-- 改变下的弹跳速度-->GN F.V~w
var BallSpeed = 20;
6j` \/X}q!]L var contentWidth;
0ZI VZg6Z'q var contentHeight;
z];lkn9p+Wv R var maxBallSpeed = 50; j8Sy1x'{Cm

[u*J,bVBLy
:FZP`"\H@ var xMax;
}#S8L)x'm'Ar3| Up*w var yMax;
iMQR+G var xPos = 0;hVykiS
var yPos = 0;{end)`&@&\V%U,u
var xDir = 'right';
j~o k+IW var yDir = 'down';p a,z/O;~ U*t$c o
var superballRunning = true;_)AX D bo)O
var tempBallSpeed;\` yS$X$A2h n
var currentBallSrc;,U(a%k,KA|"A-|
var newXDir;5Rt4~x0w4O8J aUN
var newYDir;;Lw@DHX^
%a0un }3z&{v
function initializeBall() {
t8pU9vg7g    if (document.all) {
~-v5^#eu8r1G       xMax = document.body.clientWidth,KZ8p7DQp%~T9W kA]
      yMax = document.body.clientHeight
!`u`*J2x,H       document.all("supertext").style.visibility = "visible";
*u(I)R#|3^-d#~\       contentWidth=supertext.offsetWidth/n-L1d*eLG(PO
      contentHeight=supertext.offsetHeight
pu|8tK,V\D       }uB#e.p"ZM
   else if (document.layers) {'s3@5KQ6}0g!]6I
      xMax = window.innerWidth;euCz:[e8F~IhS
      yMax = window.innerHeight;
],XqA5w yY@J,S       contentWidth=document.supertext.document.width,{8Jd*^/WmP
      contentHeight=document.supertext.document.height
amx:N @b)sf       document.layers["supertext"].visibility = "show";WTu2n%MD1@
      }
HC$sh+D#}    setTimeout('moveBall()',400);
5az H8Jocd    if (hidetimer!='')
Q2O$g/A"F2m    setTimeout("hidetext()",hidetimer)4T2F,\2\3YN&H
   }BA*ktylFQ
pQ:WFy
function moveBall() {.^` gsL}/[ R-k ]
   if (superballRunning == true) {
v5q;q};Q$`#bH       calculatePosition();3oW6\(o3V!~h'g
      if (document.all) {:d6N$rehc
         document.all("supertext").style.left = xPos + document.body.scrollLeft;2p`GY2mj
         document.all("supertext").style.top = yPos + document.body.scrollTop;X+^ uX+}8v
         }
we8Cq P       else if (document.layers) {7m/B AO*e,}~+{
         document.layers["supertext"].left = xPos + pageXOffset;J Y@7m JrYG&P4s
         document.layers["supertext"].top = yPos + pageYOffset;
"C [-~8][2`          }
%@,S#apDpP       animatetext=setTimeout('moveBall()',20);
*G%sw9a)s#Oil       }A2\R#wIiT'rl:CUZ
   } jE'q1i1Zd{
.jq:K8m I"F)R
function calculatePosition() {
\ck Hqu"\    if (xDir == "right") {v_)C1UU[,}^
      if (xPos > (xMax - contentWidth - BallSpeed)) {
^A-F"F2z(O          xDir = "left";
u#@&Z7|F*^y0C          }Xm[#AJ
      }
,O kG'}I+^.gX7A/I    else if (xDir == "left") {
r q#z0B/B;H       if (xPos < (0 + BallSpeed)) {
CQ5` \#e          xDir = "right";hwmYo&b
         }
Oe*q5R2J#I%A       }
/E)Z!]F.}+J$?6x Z i }    if (yDir == "down") {
F]f)Pg E       if (yPos > (yMax - contentHeight - BallSpeed)) {
n$r!?Rr          yDir = "up";
7[GW T;R6k7V          }
v!Z i_L&A]\       }?1q!Y5Pc}
   else if (yDir == "up") {3@9v*_-t"qk!i N
      if (yPos < (0 + BallSpeed)) {
0Z s!}S,w.z          yDir = "down"; o/O;VoZL0a/po9ap4n
         }
*cq/v,I3cF3[5G,e@L       }
`-FXN2mK    if (xDir == "right") { W`K)ol9oqC0I
      xPos = xPos + BallSpeed; YcStdG!o
      }Y9TTHgk*e^
   else if (xDir == "left") {_S&`e"JKN
      xPos = xPos - BallSpeed;-}lB C0F
      }
5_V2s.aA Q!NUS2vV    else {%e a c? g({z8q1N
      xPos = xPos;
D4e/oSj0y       }
^t7wv-X`    if (yDir == "down") {
\ P^lJNq       yPos = yPos + BallSpeed;
P3e_p aC u       }
DIbna(TO"l    else if (yDir == "up") {
(cF*L?5C,C pq       yPos = yPos - BallSpeed;+i0e+o:O$X)?%dIX-YR+w
      }
L iT L)Zg    else {
!ge?W]'hf]y       yPos = yPos;
0N8v&m o?Y D;K       }
Q4}gQ&D AUU MQ    }$T|'~ ] SFT
]r9JE9` L9|.K3G
function hidetext(){Lctw i;f6c+ko
if (document.all)
)z;}.S7Y+N supertext.style.visibility="hidden"
!O/W^+AE.D else if (document.layers)
n3~u$X(B&a"u document.supertext.visibility="hide"PoXy4u[V
clearTimeout(animatetext)XwMVu'Qcb Wq
}
} n^Ql J
YFXg2J&I CL!C if (document.all||document.layers){8@4n.F0L{E `
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')jU-@.TS8[ `s1t
window.onload = initializeBall;mJ)j{t
window.onresize = new Function("window.location.reload()");
8SvxlXX5vA6h }AwK7w'k6OzE

4IH2~d$X5k0r </script>

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


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