捌玖网络工作室's Archiver

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

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

<style type="text/css">-@q'p!Z Q |
#supertext {
._B/oJ"XM1Q!?T _ |%?E position:absolute;
v O6]h4V2bxD left:0;
!?.~;R{\%xx o top:0;
Q1Vp _ k)u visibility:hide;
t#B7f#p)P5Ym visibility:hidden;
.o1Qh-V1w@#ZMM }-~$L`$r C|tW
</style>
-k0xSJ ^c0gz xg <script language="JavaScript1.2">
*x Ed&o6O <!-- 改变下的字体的大小。颜色-->5s}*x%kK7H
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'dL.\(H?G{m P
var hidetimer='';f uz8~~VG
<!-- 改变下的弹跳速度-->&K"a eg0y4XVD
var BallSpeed = 20; fFS wSs8H A3t
var contentWidth;
1SbA%j ioA"Q var contentHeight;U t"_4W Mh:E:?C
var maxBallSpeed = 50;)iY%|0M)x&^%g

!G2I(Id4YX ^ W#[GT,uF;Gx ~3| } u
var xMax;rDKJiJ Gr u\D
var yMax;
#p3J-VV+x*h5U BG var xPos = 0;
Of9e$WU var yPos = 0;+f0g)O0Kj"H
var xDir = 'right';&_ wbs;p&Y/d wf
var yDir = 'down';
!q.lUO#L J^.\2r7k var superballRunning = true;
$m.E~;}JGD9C/KS var tempBallSpeed;+Fd9tY"A*P2z7unq+k
var currentBallSrc;7r7K#?-G\Zq:@
var newXDir;3Q0NF dU A
var newYDir;
:Aj},^&D c8}]R.` ,zL c!]2[/X9Y
function initializeBall() {
@^Q1e.y%qW    if (document.all) {
#zPf([ca1f       xMax = document.body.clientWidth
rR;dlg.[c       yMax = document.body.clientHeight
HQZ7li;ST       document.all("supertext").style.visibility = "visible";
l%U"L!cIB@/T       contentWidth=supertext.offsetWidth
o;`q+W bX       contentHeight=supertext.offsetHeight
xB;s}!|:i k'H       }+r"Bc8ZBL!Bbp!h1{
   else if (document.layers) {%S:s;I{|H1XB:U
      xMax = window.innerWidth;3`*biUph"p"_N6H
      yMax = window.innerHeight;u6Q.R P&LvX8{u
      contentWidth=document.supertext.document.width @I)OL9v)e
      contentHeight=document.supertext.document.height
)]RI)o7K w0O7q       document.layers["supertext"].visibility = "show";(yf6D6@"e:tY!tQ
      }
I ?"xlm&O3V9XF    setTimeout('moveBall()',400);/JtfI"|u Z$j
   if (hidetimer!='')
l;Q.x iz o+gW    setTimeout("hidetext()",hidetimer)HK"RyZ.Q
   }P1SuX&JB
*YZ o]&U
function moveBall() {-lK9gk`\
   if (superballRunning == true) {
6GhA Q6?5V$Q D       calculatePosition();
&P Q8CuM       if (document.all) {
0q(b&F*WSpn          document.all("supertext").style.left = xPos + document.body.scrollLeft;
D T#|#Z'V i          document.all("supertext").style.top = yPos + document.body.scrollTop;o'uU,E]E#I:q x2EI
         }2e-fh"o-h+w
      else if (document.layers) {
8DW W$I)g~          document.layers["supertext"].left = xPos + pageXOffset;@Yssc ? L$@g
         document.layers["supertext"].top = yPos + pageYOffset;)J0E\O1f~*GO6b
         }
"~XZ[*iQ       animatetext=setTimeout('moveBall()',20);f2a#?G ?
      }:q7k5oS)Tr5fI f
   }
^?5G O^-O;t 6V~G`\4w8c O8hy b+x
function calculatePosition() {0FwMpi d,G%w
   if (xDir == "right") {
!Z$b \c}.F l       if (xPos > (xMax - contentWidth - BallSpeed)) {g!sb9O&xu
         xDir = "left";
$l;V-f)d1Jx%g O          } l%~c`(BcB
      }
g j C p6U-b-},E    else if (xDir == "left") {6JY"]F!xwW'~
      if (xPos < (0 + BallSpeed)) {
&l nR&p`9X          xDir = "right"; E6m9at)bY
         }
8ouIL,T}G|       }
:l'X _bLPZEH    if (yDir == "down") {
"CD3b)SS       if (yPos > (yMax - contentHeight - BallSpeed)) {
X?q |7z#^ krn g          yDir = "up";
m9},? L&@#b |m          }
\p/gY6XoP&p5V W+d       }`i0[6E/?*i b;LZy K
   else if (yDir == "up") {;t/r u#[%x
      if (yPos < (0 + BallSpeed)) {yDsIt6l0H
         yDir = "down";&_&R2A6N2@V!Oll(h
         } G[VfV.w7O)q
      } u"a+DS2\
   if (xDir == "right") {
5Aw)eK\$k%n1D       xPos = xPos + BallSpeed;.H mK!Mcg1P
      } Hp-h4w*ev[
   else if (xDir == "left") {W k+vG'? I(c~0b
      xPos = xPos - BallSpeed;a!k)z'K.q;y$l#P'm
      }
er.CJJvH    else {
-B/~ pM^;t       xPos = xPos;7mM }D ?!~5A
      }x&gHg3wWv3N+A2d
   if (yDir == "down") {k$UAY*czwu\ T
      yPos = yPos + BallSpeed;.]|!n5I3cg yf
      }
tT/EyvL&h&i^D    else if (yDir == "up") {
7vgh;l4@!u7Y       yPos = yPos - BallSpeed;
4TsmZ`|/B|       }
[,kv3]|1uoB)^~)m    else {n/~^)Ce@
      yPos = yPos;
D.@k_ P.w1g[       }s4x| Y$o[:X
   }G` x4t0@*r5]

-O%pD6d*V*F function hidetext(){9NB^k%o1w
if (document.all)y.@_TY[
supertext.style.visibility="hidden"
,u l@3Z7y8o%re else if (document.layers)5NLuI/v U
document.supertext.visibility="hide"8g l(m-nss
clearTimeout(animatetext)O(~A6oNlC-Pyu
}
x*FFQ?/]%[6M
r;A7FR5Ea'O,^ if (document.all||document.layers){MNB7m i3bh,oPHI8O F
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
W2L eifa+gzc window.onload = initializeBall;5v7Xa#~H*B"~EM p
window.onresize = new Function("window.location.reload()");.l0@+I5j.v y\y
}
]cl,kCAQ/rd
cO4b;AVZ </script>

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


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