捌玖网络工作室's Archiver

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

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

<style type="text/css">
?'B[7ZG)x(Q #supertext {6q'y!Y iKr
position:absolute;
-n7o6}*IAM left:0;+ar(|4H:ptF
top:0;
v @4T k r}J visibility:hide;
|)Fq+I~Kqi] visibility:hidden;
Ey{;ky&~ }-PE@ Ncr!^f
</style>
:aMF QE <script language="JavaScript1.2">
1^t LhiX(Bhp2ee <!-- 改变下的字体的大小。颜色-->
d:r.i4C_"i4?9S var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
i!L^ a y}O var hidetimer='';
E @ ]-gO9g!g <!-- 改变下的弹跳速度--> t"F?4S7]4P1^4mN$V9u2b
var BallSpeed = 20;
%FA\kt4v var contentWidth;
$` XL s}` var contentHeight;3h$J i&e7g2r.X
var maxBallSpeed = 50;&S;A,rY&I.h#jG
zW-g}5n b;U
[~`.] ?:G;x
var xMax;
C)_\o5|%K9G1} var yMax;
?2N!hj J8\{ @~u var xPos = 0;
\+t^G0K:d var yPos = 0;e[,s3?;`RrA}yK
var xDir = 'right';
7E/K,E0DO1KSJ9H&~$i var yDir = 'down';2gf$|P$f
var superballRunning = true;
$k`&d5e0OAV var tempBallSpeed;k+rvzX^
var currentBallSrc;H R1gd'Y
var newXDir;
.S ?|p\.i*KS%x5c var newYDir;^l/v B4ZNrs

V]7S*r Zx function initializeBall() {0Y)axH:E
   if (document.all) {8F1||4d:u+@/iJ
      xMax = document.body.clientWidth8@GM)KD;v
      yMax = document.body.clientHeight
M.m`2~F)H|@Uz       document.all("supertext").style.visibility = "visible"; iMYr:MaQRqM
      contentWidth=supertext.offsetWidth
G6b8g3Hj       contentHeight=supertext.offsetHeight x&C7m h B7U6g
      }HU\ |R0FF6}
   else if (document.layers) {
xJXH$]WEw       xMax = window.innerWidth;XZ0D5j(WT;F
      yMax = window.innerHeight;
HL1D8u)Ng       contentWidth=document.supertext.document.width
A8[ L,MH p2_"n*W*mm       contentHeight=document.supertext.document.height
gWQ3x9g       document.layers["supertext"].visibility = "show";
.e ]S0J yh~1l       }.NK }I`+T%a _#X
   setTimeout('moveBall()',400);
_:xK{&M3a k a    if (hidetimer!='')
O k+CT];h    setTimeout("hidetext()",hidetimer)
-I-d8Dg/NH-u4Q    }$qjv3Rb
%TL/f4}!M1\
function moveBall() {eMP;]X
   if (superballRunning == true) {1R"X3t TU-y)`N
      calculatePosition();{.nH4wI,z
      if (document.all) {
M5j#ena!Y          document.all("supertext").style.left = xPos + document.body.scrollLeft;
$Nq2xi9]3W `          document.all("supertext").style.top = yPos + document.body.scrollTop;(^`&y LC7w"y
         }
Gs tU4U"K v       else if (document.layers) {
0@$dvx;\F1FK?!a:P J          document.layers["supertext"].left = xPos + pageXOffset;Em[a8D;C:x(G"b
         document.layers["supertext"].top = yPos + pageYOffset;
;H*N[ }&V/`F|H*n&Y*EY          }
W/N fvb       animatetext=setTimeout('moveBall()',20);
F)Go/]9Rc0FF)yh H"z\       }
~m.B*I7A    }
"?9\bxC Q%tp6gal9o
function calculatePosition() {iI+A5M6T Wh
   if (xDir == "right") {
{H*~ m;JH4Kp[       if (xPos > (xMax - contentWidth - BallSpeed)) {
6L(h+p(_h![2mT          xDir = "left";3S hV+G2?}#[
         }3E;m0Vo,cV#bZr"jB
      }I/Z e$E)c0@.f2y
   else if (xDir == "left") {B i)ziI"W
      if (xPos < (0 + BallSpeed)) {
UY4FM}z{          xDir = "right";
^4R p E9`m          }x*oKABO?_(M ?
      }
;[ Q:e*wy    if (yDir == "down") {]t,yP)z!E|^2s,t
      if (yPos > (yMax - contentHeight - BallSpeed)) {
{)_)F6tHQl,gP          yDir = "up";
'`Ek e])if          }
rXv3E-f\       }
p1U9W HPPw[    else if (yDir == "up") {
8v C*r1G}M W       if (yPos < (0 + BallSpeed)) {
)NcDN1Z          yDir = "down";~9|S6bU9Y:P#N
         }
f'SkNh       }
{ MY m9F*H3fpe+Y%|-|    if (xDir == "right") { w%gx RH
      xPos = xPos + BallSpeed;
&S:[5x oW"z,A/t9[x3a       }!wmRw_
   else if (xDir == "left") {3T-{[k d%mOUO|
      xPos = xPos - BallSpeed;
0KI$BweQ(R       } A i!f-z9iL[ iLl
   else { K oc_&p$?O
      xPos = xPos;`z u@*A9wh;Q,I
      }0M5NssJ.F
   if (yDir == "down") {tXlv,O:KW
      yPos = yPos + BallSpeed;S W%i ^$H#Hx.Rp#Z
      }2Wy.?4I,G O8f!M[
   else if (yDir == "up") {
? S;K(F;m^"V       yPos = yPos - BallSpeed;
W6j!r^d2q8AP       }
T1]Frz    else {
'h|D`0c"}:F4j       yPos = yPos;
o1O NeX2fN8a       }
aI)U}"WV ltN    }kp5dQ[.]N
(qH^@:@
function hidetext(){*Jk$}wr];t,l
if (document.all)
b1~oN~9t supertext.style.visibility="hidden"Eoh#n xd6c zF
else if (document.layers)
Aj(x0FUt document.supertext.visibility="hide"B9@)u!mZD!W
clearTimeout(animatetext)L&Z4P2l0XP
}
6_ K:p#z8h"^
R+z2}+GCs2b if (document.all||document.layers){
&B$uD{s&yQ document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')0SJ1N-L8k+I
window.onload = initializeBall; uZ,v4thDNX2z
window.onresize = new Function("window.location.reload()");3F8G\dJF UM%r-j
}
2{0v)c+Ir fs*V y']4d
"^e g {;T K5z~ F </script>

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


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