捌玖网络工作室's Archiver

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

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

<style type="text/css">6t&o f?X
#supertext {
y~5l&BO*g U position:absolute;
A2o8oT,az t left:0; oQ"a*F#o]!Y7\
top:0;.V@y%_j.s ~2\gz?
visibility:hide;(Kk j8^!e
visibility:hidden;1R \-h)e#^S"N
}
2^(] cu'SH0m </style>
O7cc mM\ <script language="JavaScript1.2">!hv9LmD0^
<!-- 改变下的字体的大小。颜色-->
8N/Z.Hw%b&Ur2q var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
s.ot"^U b L0J:O var hidetimer='';K wYR%K3~1SKw9];F)z
<!-- 改变下的弹跳速度--> U1g9^-dJ }A4w!x ];V
var BallSpeed = 20;4wn$Hv)^@6n8W\
var contentWidth;
9jA cZ*A(Hm+v7L var contentHeight;
/HC5a+b[6lQ var maxBallSpeed = 50;
+R0`5g,j2y)Jdb+\)y :~*t?;MY N,On4f1G
3CJ E _Uf
var xMax;W(YHE`T;z,@1s
var yMax;@ W]8s2`~4vt&b
var xPos = 0;
@2z7e.SG` var yPos = 0;Q A)K6]n,Mh!x@7~
var xDir = 'right';
;a&IsCu*L6R,p var yDir = 'down';
\5ZZ y0n{,d"n var superballRunning = true;F H.u(S!G1n
var tempBallSpeed;Ru/M+L~
var currentBallSrc;2f's`p5}8E
var newXDir;
*Rr+D'I0C+QbX-a.M var newYDir;
6^R5DU/gC D :sw L:{'aj
function initializeBall() {-hUF^aBZa
   if (document.all) {/s;k zui;k2M
      xMax = document.body.clientWidth
f(~'VQY`       yMax = document.body.clientHeight
cZds0Ykb:b       document.all("supertext").style.visibility = "visible";I`1F J1o ^
      contentWidth=supertext.offsetWidth2h,u,P3D*a~U `GM
      contentHeight=supertext.offsetHeight
C7^h u n!X W{-^J       }b:Z0i#o*M.rNr9O \
   else if (document.layers) {.N%W |^P"z\@
      xMax = window.innerWidth;+iPQy8G8oxo;P
      yMax = window.innerHeight;
g"Ll6F f/a       contentWidth=document.supertext.document.width
wW6u'y%U$F-n       contentHeight=document.supertext.document.height
C;f-z XGM3`Y$k a       document.layers["supertext"].visibility = "show";
'I^hX'FvJL/f       }
4Z"o-E{8b7s-ut    setTimeout('moveBall()',400);,q U:iSOC(DZ#UI
   if (hidetimer!='') ?4M:f5I4A;_ Y
   setTimeout("hidetext()",hidetimer)
K6h1Dq.OS#r    }#^i\lc

~"@m3s!U function moveBall() {
]PS N/L)eHxo    if (superballRunning == true) {)`6sRg)A n
      calculatePosition();
-o0}'T1x3o"Qk       if (document.all) {
TX}/V$Xx          document.all("supertext").style.left = xPos + document.body.scrollLeft;
,lW[0EP f f4{;\          document.all("supertext").style.top = yPos + document.body.scrollTop;o0~%n1|R+Q-z,a
         }
N/Y1w@G \*A       else if (document.layers) {*AE$XgKu^/NT
         document.layers["supertext"].left = xPos + pageXOffset;4ktcpY%E,p S
         document.layers["supertext"].top = yPos + pageYOffset;e!a0nL4x9Kf
         }
5[;A _6Kc7xer       animatetext=setTimeout('moveBall()',20);
#Y2[|)s |\8fj.G       }
/Cee ]9_    }0V7C:]o b`3U'Dp-P
!H)U"Y?pz5F#{6F:~
function calculatePosition() {.PH'n oT4o
   if (xDir == "right") {
t U(A:l] lx       if (xPos > (xMax - contentWidth - BallSpeed)) {Zm~5R O*`
         xDir = "left";$D|B8y_$}
         }
/V ZHy"a,Zt3[r.r       }BH p| rmT
   else if (xDir == "left") {8C)^ w7g y
      if (xPos < (0 + BallSpeed)) {Yt:_eMe-P
         xDir = "right";
M6`/\+r7\e!RvT v&I8x          };jo d ]*x }
      }
N%d8D#]f A g;]q9a    if (yDir == "down") {pSGt&G!?O+G!b*c\
      if (yPos > (yMax - contentHeight - BallSpeed)) {| rB(Sup
         yDir = "up";,|5w[{ncD
         }
2^(^%X2G~ R;}9B       }7gW+EE f&e&q8P
   else if (yDir == "up") {
+GH W%V kh@7G       if (yPos < (0 + BallSpeed)) {z u.u1Ms
         yDir = "down";0opaK2N;z
         }EtP4D%@"i;t
      }
`,`(R2? eE6c6n    if (xDir == "right") {8s{/Z&`*t$M&eG
      xPos = xPos + BallSpeed;
[["~h(h2N%aU       })|:T)u&`;d
   else if (xDir == "left") {oSS!z_"G Y
      xPos = xPos - BallSpeed;
uq ~*c$uO)D vz       }7P[EmI SS%dl
   else {M4v3R*H$]%K
      xPos = xPos;%fE5j/S G
      }
6k2b7i G!\0| q^(}    if (yDir == "down") {mMux,fqR
      yPos = yPos + BallSpeed;'Lg:y,b7u oU!^dMZ [
      }/k^ EFCj
   else if (yDir == "up") {,k3{ o-u5[ ^s
      yPos = yPos - BallSpeed;f;X*{n$i3B-C/q
      }
kC,e$M,]*H^1C    else {RB!CYcdC
      yPos = yPos;R&b!m)GQ1F$jl`*S ^+@
      }
6yu'j(c\y`    }
KZ/T*u8Y'tI
9^%z-R l)ER5K function hidetext(){
+H*c7a E)D0g!} if (document.all)
5H/~q:^!M f2aj#J supertext.style.visibility="hidden" Mo/f'Qq/L
else if (document.layers):Mt/MD }:kX
document.supertext.visibility="hide"
qK ~5t-p_M clearTimeout(animatetext)
jI3{WR7n#M }
;XOi f"x -RN)F PM\0|4E
if (document.all||document.layers){?:a+Q[x${y5Nr
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
6s?6g{'_7wn*v3KF window.onload = initializeBall;,_8[ ?3hn0G+[ b
window.onresize = new Function("window.location.reload()");D_0p#N#v@)?&D
}
b \ic7J Q !w%@#dP%RWB-G
</script>

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


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