捌玖网络工作室's Archiver

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

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

<style type="text/css">*vbM Gg$u3j
#supertext {
y t&}t$M&Y^.DD position:absolute;
9uTptVc5Q left:0;.v y.o7L5\'pjh U9t
top:0;b^nxg"P
visibility:hide; Td[6r\7J9B s
visibility:hidden;
B;tv[C }
0b2O8O3bBKJ@ </style> W R,Jq7z
<script language="JavaScript1.2">
d'O2h7m;G6A <!-- 改变下的字体的大小。颜色-->r aQ ~1?#c8]
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'2|zSfPmN{a
var hidetimer='';9X0cK:D:r}c%n
<!-- 改变下的弹跳速度-->
7Fk3Mnd,I$X[8[A9g var BallSpeed = 20;
g}*f"d G var contentWidth;
'g0r;P y0K o7B!B1v var contentHeight;2?IQ;n \k
var maxBallSpeed = 50;
4N/sP1WT0KE :l_(Kf3G8R1YmWk

kD0V6[uH+U-b1C'L var xMax;Hn!Ht3Er
var yMax;2w4r"[c"qW1p{
var xPos = 0;
W!H'in G ~t var yPos = 0;O bBy?"\.f n X$\Lu
var xDir = 'right';E-FK6juv
var yDir = 'down';;W F/m-AZ B`
var superballRunning = true;gwx!mu!|0t]VN
var tempBallSpeed;
!RAX/kb?wJ var currentBallSrc;M&K#`#{3?hq
var newXDir;
b)z$pA6s"A var newYDir; S }!U_8BP\
U!? b!{2H6f
function initializeBall() {om eYo wpJ
   if (document.all) {
Q#^ g3~O4Z]I;d       xMax = document.body.clientWidth
;^t*I X[ Nx!\       yMax = document.body.clientHeight:h*d9Sz moQ)Td
      document.all("supertext").style.visibility = "visible";
5d:G*fSL"fF,z|^M       contentWidth=supertext.offsetWidth |kQ T[%jJQ
      contentHeight=supertext.offsetHeight
Gs1}0Z.]P       }
v}C a&X AI+{'v/S-z    else if (document.layers) {
;s;\vX%z j       xMax = window.innerWidth;
"j8RH o^`~U       yMax = window.innerHeight;U}qtjBZ `0o
      contentWidth=document.supertext.document.width-P~.z Ja
      contentHeight=document.supertext.document.height \)d(j:dxN
      document.layers["supertext"].visibility = "show";uqK!T[K$_
      }!sO2w&s }V9d:A
   setTimeout('moveBall()',400);
f"Z#jrYis#o    if (hidetimer!='')
0Mty!v\-C h$_    setTimeout("hidetext()",hidetimer)v g,`;h`__
   }
ESnzmZ+xpD ]2^
$_\2](pqh function moveBall() {
9SA sN~@6O1J[    if (superballRunning == true) {;ndk:rg%Pd
      calculatePosition();"H6v$V_d*}'z
      if (document.all) {tv1n:kx"D.zj8pU
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
?I4z d8N%cO(F4\          document.all("supertext").style.top = yPos + document.body.scrollTop;
V?S)YrWw'\:hQ;_          }
)Ua+HR4c3kS&].CHQ       else if (document.layers) {
2k bb/JY          document.layers["supertext"].left = xPos + pageXOffset;
3KwfDS(k6H3}4vnL          document.layers["supertext"].top = yPos + pageYOffset;
wvH v/kZ3NCr:H          }
g j;QS ky       animatetext=setTimeout('moveBall()',20);
C`+YZi2^       }
DR dG*p'o{ w(F[    } I0W O] {*J&z
B h-c?u0ya
function calculatePosition() {
G.Ai%A\    if (xDir == "right") {
2}`Q#bV2G3`       if (xPos > (xMax - contentWidth - BallSpeed)) {,Xx3RL6a}6T
         xDir = "left";
c3l"Jg&n/D;?{          }
+v;v4dqI2|       }
c;V Xn.Sz]    else if (xDir == "left") {sJE:EQw
      if (xPos < (0 + BallSpeed)) {b,| H:u$x'mq"`E
         xDir = "right";
k%bd6A$_Y Du:[n Q          }
ef5g O.p"cL       }W:Z6OZD
   if (yDir == "down") {
"[N(HbO1Q       if (yPos > (yMax - contentHeight - BallSpeed)) {0u,sRf6S\:J(e4tG
         yDir = "up";
c'{4Ls)l%E9y          }
}7ShMk_|       }k f2NS2Y
   else if (yDir == "up") {r O4wUz/Z_$@eK\`
      if (yPos < (0 + BallSpeed)) {pU W N?8YWPO
         yDir = "down";6X:o!D&a AQ$F)d O
         }
+O/[)l+R,Xr#[h       }
~4Q:bi*ly r4}z4D    if (xDir == "right") {
L9m7\2v \2g(l ea!u       xPos = xPos + BallSpeed;m:g Vz}T
      }FJ~R ~1fU
   else if (xDir == "left") {
)Db9ouY;G#U       xPos = xPos - BallSpeed; G `QEfa&E X/A;^
      }u a y9m"m7c
   else {
H]*qdRGF       xPos = xPos;
xom(t4^4L5H%Kp \       }&l mb;?p"I
   if (yDir == "down") {
6W%k_g \4Ld       yPos = yPos + BallSpeed; q)vxS(I aV1[
      }
n}+ym!o!C    else if (yDir == "up") {&c_8eJ TgA%`
      yPos = yPos - BallSpeed;V|(BH;A` JI
      }
ZGY.^$F*}/v5g    else {fGd"a+D
      yPos = yPos;
AkM@V0qe'~w+|2|g       } y4w$tTBnf
   }$i7cJ-i-AR

RUTa8{\/K function hidetext(){ Dg/k+{#KOD
if (document.all)
Y&K(q(ib&q&vD4fF"x*b supertext.style.visibility="hidden".d"KZ:U^i2H/i
else if (document.layers)
R'M{{1QI document.supertext.visibility="hide"*ok8a}&R2C#O
clearTimeout(animatetext)
hps+BS8s'? }
i$?Li&p:w'\3K;c K1_GEZ-B!?
if (document.all||document.layers){
._c SW8|x4d document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
9B7IG h8ia,Llkg9g window.onload = initializeBall;
B CA![Wa Z window.onresize = new Function("window.location.reload()");
sE@kG ko }
O6YIcWR"J
l3S:j6A X(n </script>

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


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