捌玖网络工作室's Archiver

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

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

<style type="text/css">
_q$dp+bM+K #supertext {'it;|Y4L
position:absolute;/m.hB P/bA
left:0;)n#UQC&t^
top:0;
JXE,h |:E b visibility:hide;e_ w3wM _o'G4|
visibility:hidden;"Y_p zJ8IiU:t
}7U]'ym@"|
</style>{/MhyHs!n&WI
<script language="JavaScript1.2">
'p!q7D7f(mu!D v <!-- 改变下的字体的大小。颜色-->
IS*Lk%^7U/N var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'7X6e2q$a)[tw_
var hidetimer='';
l y"kQa(}W&kd <!-- 改变下的弹跳速度-->
P Bpf7R"`:CabQ var BallSpeed = 20;P]$u,^uE D1u9O'Y3q Y
var contentWidth;
0Yu t8BZ;d2C4vi| var contentHeight;&ZUiS%^0N7W ^fLR
var maxBallSpeed = 50;4S+M#vECW?~#D

D$ZQ6x)C z,M
(Ow&h ddW ]'UE#l var xMax;T b,D6~5jc
var yMax;cH0@nz
var xPos = 0;3s0\5@!_C`i2^T
var yPos = 0;?b]7CCy
var xDir = 'right';
?-h7J|7Y R.YW^ var yDir = 'down';6Ma ?J0U%i+A i!\l
var superballRunning = true; QJo.aO`
var tempBallSpeed;t3Hs?k%xp{
var currentBallSrc;%N(Ce+{#Egn k5[E-E
var newXDir;/K X4R;e{
var newYDir;,Mv.m?9l2?U

X9} s,M7{#] function initializeBall() {;f,TY5E(MV+E;V
   if (document.all) { XfUZSc
      xMax = document.body.clientWidth D!lBXs0n-yx2~\
      yMax = document.body.clientHeight
[{sPc#v       document.all("supertext").style.visibility = "visible";
&] cF/r v,a-I       contentWidth=supertext.offsetWidth)r{"[Ih izz%]
      contentHeight=supertext.offsetHeightc:dO'PG*Z(W
      }
'QGS;Q5L)@P    else if (document.layers) {N1oxDv?
      xMax = window.innerWidth; HcG |jG!nGo
      yMax = window.innerHeight;
2A @z`k3`t:Xj       contentWidth=document.supertext.document.width
!d/|T n"dD^       contentHeight=document.supertext.document.height
Y+RU pi ?H       document.layers["supertext"].visibility = "show";
O hh&d$w|       }KRS xi_4D nz#c$c$s
   setTimeout('moveBall()',400);xO~9t0^$QD)r%`W C6a$E
   if (hidetimer!='')
'^x~MAlkAdi/E    setTimeout("hidetext()",hidetimer)
A,@X lb6c:b    }
9D\T8f4Z| /Z2J-v_2CzoLv
function moveBall() {*wk;b!rr+M?
   if (superballRunning == true) {
uk(O4cE|?0K#F       calculatePosition();.f2Q%[9|z$G:cnu t-pT
      if (document.all) {\ jW._dA[/eg nd
         document.all("supertext").style.left = xPos + document.body.scrollLeft;4X7m~c*\
         document.all("supertext").style.top = yPos + document.body.scrollTop;3K*Z*V5X\*a5} n
         }9dU ] `cd`7R(F
      else if (document.layers) {{UQ8L+uRB"B;M
         document.layers["supertext"].left = xPos + pageXOffset; a*c+f#bI1U
         document.layers["supertext"].top = yPos + pageYOffset;
O+WrZ%_0p.W;w          }
6WX7G H-A4lQQs       animatetext=setTimeout('moveBall()',20);2d j`[(?l
      }S1M;XI&CE@
   }"Y(J|E"W7D
7[s/a%b|
function calculatePosition() {
yom+oM p e'`*C$C!]    if (xDir == "right") {
x|d5RS-?       if (xPos > (xMax - contentWidth - BallSpeed)) {
G;K~1_i8j          xDir = "left";
.Pf lvoJ-Nm          }"d!F8wz x\6Z`
      }7j q'A G T
   else if (xDir == "left") {+`6cY Fx
      if (xPos < (0 + BallSpeed)) {_,vA'Pg4A&h
         xDir = "right";0B _+h?F1A2?Ji []o
         }
C0n-U E:s*A       }eAp bg/sG
   if (yDir == "down") { w0Q!M;B8}^6ObV\
      if (yPos > (yMax - contentHeight - BallSpeed)) {
_.F}$| Jk          yDir = "up";X_ a {8y(|
         }W2Ir bG`/W
      }
j2WP8Z w    else if (yDir == "up") { BL4KXE9D'[R`
      if (yPos < (0 + BallSpeed)) {7m\*[7[^w
         yDir = "down";
6vP BZg:M          }
*B7R RK1Al(W       }
:p(B(Y6[)VQ t    if (xDir == "right") {
%A.A6Zl r)x+I3Wb:@ s       xPos = xPos + BallSpeed;
Rd{n,@9e%xS5p       }
{ot/@PJ ]%n"J    else if (xDir == "left") {
9_r+o3Ks#p;qd!T       xPos = xPos - BallSpeed;A:TUz+s!?
      }
~2p!p)b ~,_    else {
;be O&Sg*y:O:w/h       xPos = xPos; _,d9E)w/\8? mJ9l*T
      }
uCPL&\1vn.T    if (yDir == "down") {7D MA-@A
      yPos = yPos + BallSpeed;6XK!t1r!M
      }P`{8E/g
   else if (yDir == "up") {
&lg M/R3z&M(z`8R       yPos = yPos - BallSpeed;wkm]u.Jb PH
      }
5j!H4I9o)h7r} KL    else {
wZu4U3I&je       yPos = yPos;
,p[;Htfc!kZB       }
5U#w q(B+mpQ%k    }N;`9{\7BdD3Si

HE!ZG/m7Pve function hidetext(){9E$PkN9vy.g3Ja
if (document.all)
z'}g,e,_:wCW0v4Q(w supertext.style.visibility="hidden"8K1[JFoM8z%U-O
else if (document.layers)+E-pk;i8~5Z$Rl
document.supertext.visibility="hide"
O|?aj:om$Y clearTimeout(animatetext),y@cL]s
}m9\:\^gI H
?o:f)F&I s'DL
if (document.all||document.layers){
.D Ok/o D:f document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
X3\@B%y6fc window.onload = initializeBall;\8v2r vw,k
window.onresize = new Function("window.location.reload()");
j}X aCI&Ry }
[ k7qe r*`(P
j6YnZ*i F#j hb </script>

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


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