捌玖网络工作室's Archiver

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

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

<style type="text/css">D)j s-I)~ WLV
#supertext {3T f,CMa)}(Q-Z&TC9e&{
position:absolute;9yOEG7J$B*T
left:0;;`hK)k6`;zO
top:0;tCk6|g
visibility:hide;6q V6j5j;o"_D
visibility:hidden;
,A)A"|H-|;U }
6X*b1O H9k ^*q"L </style>/RRg{ d r~
<script language="JavaScript1.2">
H(U\D9XW <!-- 改变下的字体的大小。颜色-->MX&pD*K2S'J P
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
L,j9R2[z)?!P M var hidetimer='';r t)^H p+V/L|
<!-- 改变下的弹跳速度-->&W9k s)L+F!jy g
var BallSpeed = 20;&n w"~6j(@e7W(~
var contentWidth;9` XX;T J"A'xL+?
var contentHeight;
VY F!K8|1T var maxBallSpeed = 50;u?"P"wp U#]
wm_:nn

]~a$e~Ml7X var xMax;EeQ;iv
var yMax;
9OrHUp&|C8dG var xPos = 0;
TiD e ]8x)Xs"Gtt var yPos = 0;
]J([!Bm AL9^_ var xDir = 'right';
tJ0\.E}];l2e-R6AR.A var yDir = 'down';r)] Ni`)}%b,m;b
var superballRunning = true;E6?5l@'dv
var tempBallSpeed; m4R$i/|.c6]#i @
var currentBallSrc;GeO p/n&V'J-N3Z8A B
var newXDir;L ]:E)uqysm)L
var newYDir;
"IEx9H%v*bm\b*bh
sj&B {*]Z@$@:Zr function initializeBall() {-n2@ vO-s
   if (document.all) {
R @(m(`"^gko] m       xMax = document.body.clientWidthbt"L%y2Z.x%J _
      yMax = document.body.clientHeight
w.o$@mW/Me#r+S       document.all("supertext").style.visibility = "visible";
`-Ov[_%b7PG       contentWidth=supertext.offsetWidth&Ye%Y-zI tY5[ K
      contentHeight=supertext.offsetHeight
+i(e6i,U9yln4|D7d       }
C"f,g3hQ5Y;b    else if (document.layers) {U/m;c[3e!C
      xMax = window.innerWidth;"~;y8tA0y+F8zM
      yMax = window.innerHeight;6q0GmB G1V"xq
      contentWidth=document.supertext.document.width*[Rs};E,k"d]
      contentHeight=document.supertext.document.height
o2e$h F0A@ s       document.layers["supertext"].visibility = "show";a iS,n(M'sz!H?
      }8^;r[E/b(U%Sc
   setTimeout('moveBall()',400);:kM;pRFK2z3?
   if (hidetimer!='')
*C@5}~(P-iOM    setTimeout("hidetext()",hidetimer){%p,|n8}5i^
   }%r1q B%f1}*L(m3D
o5l~:B4n6n
function moveBall() {/l7K,T_*Y9Wm1H f)l
   if (superballRunning == true) {;vYh d5r@ z
      calculatePosition();gJ&p3u"O3v
      if (document.all) {wmfeV Zo]z
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
Z `,O1W#B@:Z$kj          document.all("supertext").style.top = yPos + document.body.scrollTop;
^V3H z)jny Q          } ?KA-m$pSG0m
      else if (document.layers) {
FZ5W6n R/x Sz          document.layers["supertext"].left = xPos + pageXOffset;
*lj?+a:u          document.layers["supertext"].top = yPos + pageYOffset;
o x k1J+T-mM%U          }+w#D^0i1g(e9Z
      animatetext=setTimeout('moveBall()',20);8rl8x,g"y U(d5aI
      }
g FRo1a    }
e2iP9o'j:pU
q,e'U{U6S]J function calculatePosition() {ycf*zB
   if (xDir == "right") {
b)t!Eq+Z?       if (xPos > (xMax - contentWidth - BallSpeed)) {'Psnr1I
         xDir = "left";
Xp+`t8^a          }
9Zp] k&^Yz*g       }5` p5Z _6e8ZhwW
   else if (xDir == "left") {th KXJ1yM a
      if (xPos < (0 + BallSpeed)) {
^)h wpoD          xDir = "right";q*Z1Y|'j)|'W9yV.M)l
         }
V#juHHre |+m%g       } l1e5J@j3E
   if (yDir == "down") {
v0NHx0P(t7H       if (yPos > (yMax - contentHeight - BallSpeed)) {
4[/lI.h"I2rM          yDir = "up";N*e { is TqR BV C
         }
\5Zjjwf       }
T-d,|u'YN8PGf R+Y    else if (yDir == "up") {(W,D_)Wft
      if (yPos < (0 + BallSpeed)) {.eN'v1r'U
         yDir = "down";
B$e h.AD'mS'_tI          }u z_%Se"`O j
      }
MUyO"jF    if (xDir == "right") {i7S ?"{%QdHBpE d
      xPos = xPos + BallSpeed;
2W:D2?JQ:p~o       }
H9L ckz&T    else if (xDir == "left") {
}$z6x;Rd q B8H       xPos = xPos - BallSpeed;
? ib&{3l7Q+lg       }$w b-U5Zzx
   else {
3K%YI;G|I Y~^{       xPos = xPos;{&ex}.D|G
      }z!AOLSE,kI
   if (yDir == "down") {WR Qd#MrgY
      yPos = yPos + BallSpeed;xsTb z8s0_ k
      }
kS vV yD_    else if (yDir == "up") {
.H4Y%k4fG0NBG{       yPos = yPos - BallSpeed;
&S2p2b'O x*Rd       }%Mz#E(Js/x
   else {^ ]A&M~!h:_ p vg
      yPos = yPos; LMa V0`i A(v g
      }5f(kbe}Y|.i"F'w2u
   }
oru9vC N2CTq
PB~fsWs8k function hidetext(){
gaI0v'j3S ~ if (document.all)
t D @,}Q bx(B!n8_ supertext.style.visibility="hidden"mb9h7Pt
else if (document.layers)r F&lZ)\p da@(s
document.supertext.visibility="hide"
.~OK7?2f_\%ode clearTimeout(animatetext)c/y8T K)M ~5B
}
$T$IUwh"I~p 1x,ml*~ H
if (document.all||document.layers){i$v0wL8V a$y7D)?zQ
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
!j1I3_*Uq8m window.onload = initializeBall;+Dz5\zI]C,r3t3G-G
window.onresize = new Function("window.location.reload()");
X"l/A%F P-M }
\a7hG g
#p({P f+i&tP </script>

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


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