捌玖网络工作室's Archiver

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

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

<style type="text/css">
.eO#w(D1R #supertext {x%c,_y2p
position:absolute;Uv g3DK cV4G
left:0;
ZlJF K4RW9]f0N top:0;h"F Z#e nLU7Yk
visibility:hide;
\@V!K#[;i%P visibility:hidden;
Y6{2{RW"Ap(c;xO } ZBn*N-q0B
</style>-mf2Z2LD;n,GI
<script language="JavaScript1.2"> ~wH5n7R S gf1F
<!-- 改变下的字体的大小。颜色-->
-Ak,P`W-L8G WU var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
5p4?!M8[0[\3K var hidetimer='';
9`)hW)X+yI <!-- 改变下的弹跳速度-->:M0j9K6@BOT.\
var BallSpeed = 20;H.EO(fS1c
var contentWidth;.m}@d&x
var contentHeight;
AV*qNNL var maxBallSpeed = 50;&^dDY1y6u~/t]3n

/WB)@'E{4MI/x
H8o{`,CEL&J var xMax;
[5i9z+C/v%^lM9KJ var yMax;!{f'{-`1J]Z@(|
var xPos = 0;-ps%Ahhf@1d3u
var yPos = 0; aW1Bkd&p
var xDir = 'right';L3v|_+y%M4T&z
var yDir = 'down';
OS M2AU&Fh1L c6F#s var superballRunning = true;2mq5l.tj xdX2m4_-z
var tempBallSpeed;4F1Y3Z.d]n
var currentBallSrc;.SV3o2~pLl [
var newXDir;rzseZ c}
var newYDir;"L0X,eCUEI1gE

x"b-RI1[K6^ function initializeBall() {
oFx `U    if (document.all) {qW-[|6^
      xMax = document.body.clientWidth
v$w7W7rqC       yMax = document.body.clientHeight'}Ta:^Ey T U2I
      document.all("supertext").style.visibility = "visible";
;eL-?0XY+u:\.G'?       contentWidth=supertext.offsetWidth
(EC ZN"{ Q       contentHeight=supertext.offsetHeights8q8\:p-z N
      }
:|1i(sR;hzPip    else if (document.layers) {
5Pde^ TsA}B;O4C       xMax = window.innerWidth;
m2x7DY*chOSw E\9?^       yMax = window.innerHeight;0y7r!rv-L| Q
      contentWidth=document.supertext.document.width
$c` _Mx6Vbd       contentHeight=document.supertext.document.height
&e)?lWag`       document.layers["supertext"].visibility = "show";
YZ,`,W-W YUbG       }k5z{ Xr
   setTimeout('moveBall()',400);
1pG6Vqu@B    if (hidetimer!='') \k]"zjzW
   setTimeout("hidetext()",hidetimer)
/X7tht-M9_VC}6K    }
JLt8F^#_^
Tc,P7Tj3qm function moveBall() {O @^b8]2}/Xn6I*Rh
   if (superballRunning == true) {6gv4[x`,nxo,}@
      calculatePosition();
&RH:v)S Pa5n       if (document.all) {.R&F4`p3BC8C"{
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
*@I{,[q!n          document.all("supertext").style.top = yPos + document.body.scrollTop;
6_ZF n's&\r-o4U*Ij:W4Y3X          }*_f6@0V(U"Sn H1{
      else if (document.layers) {
^|9e2p {,C$j$s          document.layers["supertext"].left = xPos + pageXOffset;
f'd%u@+a F,{qwi          document.layers["supertext"].top = yPos + pageYOffset; __L(G6qjJ(d
         }
&r|R?y.fO       animatetext=setTimeout('moveBall()',20);
:~2I1RRS7M%W       }
n%N mrvT6Dc K    }
0EbAJ3c7C zrf*O
0H$I;rb hmt function calculatePosition() {8]5v6o ?0Pa-o!h I
   if (xDir == "right") {
|J5Z\:V!M       if (xPos > (xMax - contentWidth - BallSpeed)) {]~3N2t1d?
         xDir = "left";
8U*D"z(n x,lSq$D3W          }
:T0x4pW{%_       }
B|,EE%q    else if (xDir == "left") {
0N W8US2b'z8D       if (xPos < (0 + BallSpeed)) {
;?+jrn3e+`5F          xDir = "right";
U,zZ2WdM          }8Wrg:P(?9d r
      }
)DfH#^7X@ cw    if (yDir == "down") {
b/c~ R^g       if (yPos > (yMax - contentHeight - BallSpeed)) {
2sRr&m1~HZB7}          yDir = "up";`/_ nT F w0|H;o-v3k
         }#~gn{oI/kZ
      }Ms!eKSb&SC$y
   else if (yDir == "up") {
}-C6@vy~g#y| I       if (yPos < (0 + BallSpeed)) {
c4HiZ.f j#J          yDir = "down";
(G)D'D/I:w          }1Y7g8i%["lI
      }
2z)N2Uex*ky    if (xDir == "right") {2M9B1q {-^e"zC
      xPos = xPos + BallSpeed;"g q*G~P
      }
];zh)F K2B/Q    else if (xDir == "left") {
Amk#n.},^`       xPos = xPos - BallSpeed; Z V io {sZ
      }
2w9]"kin}g}    else {x&}m_q{+iA%|
      xPos = xPos;
)b+pqq8O0c,Dqw       }
dp5vQe+y    if (yDir == "down") {
pR.bul0I       yPos = yPos + BallSpeed;
n yxPZ       }
1Qf _0Y i'@    else if (yDir == "up") {
Q*W*K0^w#A1]       yPos = yPos - BallSpeed;QP{"oZv _
      } NA+wdNI%s!e
   else {
LP?M4B       yPos = yPos;
4c K%K.q*fZ_4[Qtv       }"N0O0F.J.@J({MR4n
   }
&G&~1W#U'c QiP
%[p)kt C k function hidetext(){
B"J[NKm2b;j%| if (document.all)
$Q%{3s?h9y supertext.style.visibility="hidden"
+J.Fh/Jlq*i;Z*h-q ]!? else if (document.layers)
1e4aF6_5H7er document.supertext.visibility="hide"tJE}3?
clearTimeout(animatetext)+N-I4a;~pQCJ
}
X W{ Q Inp `F6vJ)] n X)Z
if (document.all||document.layers){
'U-X9TgC nJ document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')9O2IW$SK?
window.onload = initializeBall;
TyI0n{` window.onresize = new Function("window.location.reload()");
QDcP `Go }5^Ir~4k2`[B~
6O(c"QK}#|3r
</script>

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


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