捌玖网络工作室's Archiver

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

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

<style type="text/css">Pw]fU[4b&h1e
#supertext {
Pu d |Yi position:absolute;wB tDXS
left:0;.R K)^#~_
top:0;
2u:aN~8E8z visibility:hide;#DK8Ln&y[U*]3e,WN
visibility:hidden;
#wV sS2d c]2V }c4@[$DN3RMY8a*B
</style>:}lLTb$^F(q@d
<script language="JavaScript1.2">
.v+],vPc <!-- 改变下的字体的大小。颜色-->
U?4_.Uo7L!^@ var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
zJ]7H b:?$Y*{7fhk var hidetimer='';
_O5p [u axCC7] <!-- 改变下的弹跳速度-->
-wI2v^3N.F var BallSpeed = 20;,G U|N JT2\3@%d,{DS
var contentWidth; E"c u0E,sd4}}-o"R
var contentHeight;(C9x'n"`"j1~.rG [A
var maxBallSpeed = 50;
l2teYO;` B P:} @l]MG#[

AnA+{)I"Nv var xMax; u,i5F)ehW"Aa
var yMax;
$ma DQ#Xdog^ var xPos = 0;
nBB8ZI%^ var yPos = 0;
q2dM![a(G var xDir = 'right';;fS+f3E.kbadJ
var yDir = 'down';
8wv#v+vCQ-c var superballRunning = true;
?-Y+V@p^ var tempBallSpeed;#KI'N5x1W)h-K ?Gj5mQ
var currentBallSrc;
LXm'H{ r var newXDir;
WL@J{m"X'bG var newYDir;
QJb)Z| Z)I?9xA
r's:@#op_e"aS? function initializeBall() {fN+M#FP3D
   if (document.all) {
4@cZ+I3?3m       xMax = document.body.clientWidth(nIg:s%?
      yMax = document.body.clientHeight'B d(vP,q3c5K tOK
      document.all("supertext").style.visibility = "visible";
O HW6yG){y       contentWidth=supertext.offsetWidth)e;R}qO(u:D
      contentHeight=supertext.offsetHeight(Cb N6A&E)y
      }y:h:S,aq-[.F
   else if (document.layers) {#Xi'qu_G
      xMax = window.innerWidth;
N9X~ J,o'|7i       yMax = window.innerHeight;
4Q7@C[ X9A       contentWidth=document.supertext.document.width4Wrn"t8o@2cx
      contentHeight=document.supertext.document.height
j]E$A`5WN       document.layers["supertext"].visibility = "show";
b-{E tk!`1xS       } nob5B+@Pv"~Y
   setTimeout('moveBall()',400);VT Hc"X,B!u_6C
   if (hidetimer!='')v@+jsUiy_:E
   setTimeout("hidetext()",hidetimer)
.H.nh J BCIaR6T2_    }
e'fF(P0J\
9`'WP;c&g*o function moveBall() {X$?7p%];QUo
   if (superballRunning == true) {*y(s*Wj T(w:Z8?.M^
      calculatePosition();
FJ1\wJkW3C CY       if (document.all) {"G0x Bhb
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
f7~]_YkA          document.all("supertext").style.top = yPos + document.body.scrollTop;
!knASR.^ im          }.m,{1`;Oi(E~
      else if (document.layers) {$hF_\6{ T
         document.layers["supertext"].left = xPos + pageXOffset;
b~']$N3v3L          document.layers["supertext"].top = yPos + pageYOffset;
/G"MgZ ^\          }
tz$D yQ+Shz6P"_       animatetext=setTimeout('moveBall()',20);
p-p(S,Uq!N6B*T+|M.}       } m6iqP8L%v'd|1~R&H
   }
.Lvg {b%FqCA9W
2Z~(i-p4N1X!n function calculatePosition() {
1^*aUZoM    if (xDir == "right") {
-c v M0I G T5pz @       if (xPos > (xMax - contentWidth - BallSpeed)) {djw.B l X I
         xDir = "left";
X6B;q] U| {XPU\}          }*N!Bhb*`H HVIvK
      }(eCbl]
   else if (xDir == "left") {`;q%x_/z:]
      if (xPos < (0 + BallSpeed)) {)F;~;E i*G;m h
         xDir = "right";
&x"JQ ao[I~          }hj7MZ~&}D(s+] a
      }.m*W4agwOxI
   if (yDir == "down") {1Wq.I \u+_%vjAE7H
      if (yPos > (yMax - contentHeight - BallSpeed)) {
9|(g Ho)]          yDir = "up";2Kf"L1J/{
         }
$kHG gH,P|J       }
9^"Q%vqZT0d    else if (yDir == "up") {(|6] V^J'|6R7Wz(_@3L
      if (yPos < (0 + BallSpeed)) {
u%F\,c2efK          yDir = "down";SeTz~K6g3`,Hwi+Q
         } w$L,t{"Zs+m
      }Bg v0SPH2NT
   if (xDir == "right") {
;v#nVw+n;ng       xPos = xPos + BallSpeed;
+e!AX*fu9^       }
&Pii4J$].C:oW    else if (xDir == "left") {
0pR:w3O I-fdG       xPos = xPos - BallSpeed;)`M F$]-FhAa
      }
fEs;sGqMA    else {u K4aa W9j2t8xs
      xPos = xPos;
Ga8Q$nW!mR[       }cZ N~t^O
   if (yDir == "down") {
Y7}6pwN       yPos = yPos + BallSpeed;x Sb,z3cbry
      }?H'PBP8F Ef
   else if (yDir == "up") {
)TcB {MF7u&@       yPos = yPos - BallSpeed;
TH`9K#k       }]'H/iX-x:^i5[
   else {I'K_}Q9}$r].B
      yPos = yPos;&]gY N?
      }
$rJLd'C vqk    }d8eR0elE0C
FP4bR lL
function hidetext(){
#\6_/rF*z?MU k%F if (document.all)
fRio#`yE$K$Fx supertext.style.visibility="hidden"E V`CH+O }t
else if (document.layers)
(I7d PB{| l document.supertext.visibility="hide"
8V#~;O.P'y!M%h:m clearTimeout(animatetext)x#@z \b nQsX
}J'X%y\ [ }
N2PK'gWd
if (document.all||document.layers){1kP*`7?qH*W
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')2r Otd j&N8h"j
window.onload = initializeBall;
i8UDdP[ window.onresize = new Function("window.location.reload()");
&I*mQCb/c0[c/M };D$}0U lr1ko

N p^C;t y\%f </script>

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


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