捌玖网络工作室's Archiver

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

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

<style type="text/css">)h ZS/X CW ~c~
#supertext {,a5X;?9El^%jKxWw
position:absolute;+^+x.cY@b fw
left:0;
.W)I)uH5vd top:0;
N-\"v A?Y.NP visibility:hide;a+RD[3]-@1T[z7B
visibility:hidden;
{}J9z@ n[u }
-nU3e"P&O`6_C </style>WD*L1[1H
<script language="JavaScript1.2">
few:n5c;@5o(J2r7[V <!-- 改变下的字体的大小。颜色-->
&H5e"e!o.}$Sx:P var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'%b5\sDC3a
var hidetimer='';
U*zu `E9Wk ^O <!-- 改变下的弹跳速度-->u2{x'AUX/{{0q
var BallSpeed = 20;
6Q E OC:Zs%@p#G var contentWidth;}\Z:`%{ulM#V$q
var contentHeight;
A/`S"y*ml3L+j var maxBallSpeed = 50;h` yF;i%fMh

R] mPR2@&d 0@x,Le!g,`(@lR
var xMax;2V,Xd5MF|-B
var yMax;
S!M C"i(?y(x var xPos = 0;
-UviD7W US var yPos = 0;
q&qaja:? y var xDir = 'right';4y'E8c dc!m@ i
var yDir = 'down';vCVw%N["? p g.S
var superballRunning = true;p9I;heV"|a2GOPt
var tempBallSpeed;`6aS$ZFr+W D3fd
var currentBallSrc;
A s"a0tlM[ var newXDir;/K"T~GD;a
var newYDir;
!{hYLG Z
r]&L3@gHW Hz~"f function initializeBall() {
r\8{(b$zg DOor    if (document.all) {
Dj v,W2f Dm&Tj"k       xMax = document.body.clientWidthl{;G J/y1W d3I#yY kp
      yMax = document.body.clientHeightS1l@(Qn.A
      document.all("supertext").style.visibility = "visible";
Z;~n&|Q5a5D       contentWidth=supertext.offsetWidth,mD)lK&M
      contentHeight=supertext.offsetHeightX/L8cO}Ev1ve
      }'Aol};?ay}
   else if (document.layers) {
O[*Q |U$v       xMax = window.innerWidth;
F"@5KSCa       yMax = window.innerHeight;
l+y2]u] XYT0T       contentWidth=document.supertext.document.widthkVD&Qi5eU-~\
      contentHeight=document.supertext.document.height
/Q6zf7w|\       document.layers["supertext"].visibility = "show";
Hl,a'x(kq%T       }\"nX.k;S;jg$p
   setTimeout('moveBall()',400);
.MEYu4c0AmZ f J    if (hidetimer!='').euS oT-zT*_ ~;h])g
   setTimeout("hidetext()",hidetimer))\`V Ra+o `Q
   }|1|,Q4}^gv

4e7hOyy vRO%n~ rX function moveBall() {RO/wL'[\/l3mii
   if (superballRunning == true) {bR$f/X4WR,e
      calculatePosition();Pl'B0g7JT
      if (document.all) {u,AM)s'K3m9h
         document.all("supertext").style.left = xPos + document.body.scrollLeft;K\ B L*G!}:a ?
         document.all("supertext").style.top = yPos + document.body.scrollTop;
b$|#Tj] _7|-K Z%Og          }ih'isM,YS6N
      else if (document.layers) {
wZp)fR,q$O X6f          document.layers["supertext"].left = xPos + pageXOffset;M-MLw?
         document.layers["supertext"].top = yPos + pageYOffset;
c#m7PC\:`4P          }
G3xYYC ~ b#a A       animatetext=setTimeout('moveBall()',20);
gN(Pi+pg6v       }'Q+O){Y&iPY4{
   }
RC3j|2f6de 5N(d1Rl S'R1o:|_6y
function calculatePosition() {
L1y"Zt g w@s p(~    if (xDir == "right") {
D|p M8U;}J#\       if (xPos > (xMax - contentWidth - BallSpeed)) {
3t[1V6Xrwk          xDir = "left";Vm%p%\9vpR,k.o'G
         }!PIH u(^
      }iF t0r,PE
   else if (xDir == "left") {
Y)bD#A3L"i3q       if (xPos < (0 + BallSpeed)) {
P7^o U"M S-^bL H          xDir = "right";d bm2R.p
         }9Vs+NyU
      }
7G:JF#a\k?    if (yDir == "down") {6mo{[ nU~IbV4\
      if (yPos > (yMax - contentHeight - BallSpeed)) {
BX1c,{7t,\7T          yDir = "up";
_"] mWs6yX          }
_ MU+^ ?@TQ       }
7{&T-ky m4N#e6~~-A-_'}    else if (yDir == "up") { q|'C+@Ftg
      if (yPos < (0 + BallSpeed)) {
,Kq;Ee#[i          yDir = "down";pWq?7V
         }
6corry7A})gk       }
1gQ4d l*~`"[~    if (xDir == "right") {
W#F8W,UH6g       xPos = xPos + BallSpeed;8^N6a(`a:D0FWG"z
      }
5p(Vh*J@v$k    else if (xDir == "left") {1G%^J!bg)~i$]
      xPos = xPos - BallSpeed;.h y"^2v-hBD8a
      }
W W|z+[x w xY    else {+b!E`H bOg
      xPos = xPos;q(ZF,KfM(E*kp
      }
G[ t\Vz/n;ogxW    if (yDir == "down") {JT,BN1I`aO
      yPos = yPos + BallSpeed;]/znARPY
      }
y4PfN ^({[    else if (yDir == "up") {@ A B$zf,o `6f
      yPos = yPos - BallSpeed;
M;c FR&o%A/uV       }GY%l` N
   else {(Zt?-X0I0j@5A a
      yPos = yPos;
0yV ~(kUN~       }+S*O1xR/\*zMU3xh
   }
u*p/| cyF z1ic P3zXQ4\
function hidetext(){ v/w)NVSq?
if (document.all)Q;\BL#Zm2DL:p
supertext.style.visibility="hidden"q6@-d2J*b0?tb)c
else if (document.layers)7|6s r[#U_ {
document.supertext.visibility="hide"zchU'y1k [S
clearTimeout(animatetext)+}0|Zm%~
}#Z-r~}5z*P
8Qh-u f,h2o6w/A&t
if (document.all||document.layers){
g5i&COA document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
Q p+^:o/b |#[e window.onload = initializeBall;
1KQ&m:Zx window.onresize = new Function("window.location.reload()");k8Vv ~Xf.T
}G[*{O"x3f8t
)Sp,y%I7W"I o ly.K,o
</script>

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


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