捌玖网络工作室's Archiver

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

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

<style type="text/css">
5I,MF&\L5a0z6iF #supertext {4A'cT8oe{9O(f
position:absolute;9ZeoW? D'GBS
left:0;
B4wI4BE%?+E-j+o5y top:0;
8e&F8Z)?j visibility:hide;
|-]6M/S y(e _ `7j[ visibility:hidden;
(r_z!lu"uX }%d-_Kri^
</style>L A8DQw,ztw XB
<script language="JavaScript1.2">
l D?j qP,V <!-- 改变下的字体的大小。颜色-->s;\P$dw Z`Wj
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
2` bx5h)X*Z)I var hidetimer='';2NUNbg:Gs
<!-- 改变下的弹跳速度-->~Y Ij"qC
var BallSpeed = 20;s*{EZU e2y3t
var contentWidth;
f&c%uo1ef var contentHeight;/mg\#U]
var maxBallSpeed = 50;
%P9|Z)hN Iyn]yBn
R'kxTNY3KJc4l
var xMax;
,rw#Dd+Xl2t+S var yMax;
3ieN3E3U wx2T5Bg var xPos = 0;/^q Ak3? ` vx
var yPos = 0;^"Y6N&Fn,hKem|6|v
var xDir = 'right';
h'V D-rf var yDir = 'down'; ^ ?Q V Gq@@f.m
var superballRunning = true;
nzX6E4k!z#WFt var tempBallSpeed;U_!R(rL
var currentBallSrc;
n]m k8du#O H:H var newXDir;
J&`(V$|8| var newYDir;%jm2wr f7f[
(b3C i(j U!c:vQJ R'L
function initializeBall() {}%G PN IT
   if (document.all) {2Lu[H$u?D
      xMax = document.body.clientWidth(P.`GW6t/Sg%qE T\
      yMax = document.body.clientHeight)|*J;`_j
      document.all("supertext").style.visibility = "visible";
(x'h&_*bt{!k KP       contentWidth=supertext.offsetWidth?#w `Bz'j| f
      contentHeight=supertext.offsetHeight
r#hL$b2L&E/w]-h       }T+X,o%\]:q8Z+~qt
   else if (document.layers) {
v6]2[g&S^       xMax = window.innerWidth;
n/n2o%W S.x;O7L       yMax = window.innerHeight;
%F {Fc ff!Nkg       contentWidth=document.supertext.document.width
c(C4t}?%SV6^+WD       contentHeight=document.supertext.document.height k*Fl2\ EGc
      document.layers["supertext"].visibility = "show";zR4TW5@
      }
Qpkb3sV{.G9V    setTimeout('moveBall()',400);
u(DVD+[^eG    if (hidetimer!='')
#I+|7K$\!? ly5}-n    setTimeout("hidetext()",hidetimer)%K-F'A Ch
   }H"_ NJ3T&]k9WB
9Z\~ ]2I
function moveBall() {
mG6yW#}    if (superballRunning == true) {
F`tgRz oC       calculatePosition(); qk'Pw$B'T1y/F0Mw
      if (document.all) { P L;j5Uc ?q
         document.all("supertext").style.left = xPos + document.body.scrollLeft;1F7h.ksZSI+L'sH
         document.all("supertext").style.top = yPos + document.body.scrollTop;
{(E+{~'F4jXk          }]^9q_7o*L
      else if (document.layers) {3Y z6m \ukHw/tR
         document.layers["supertext"].left = xPos + pageXOffset;
_8JN+At          document.layers["supertext"].top = yPos + pageYOffset;]MW y5{t
         }
*oi P:\:\]}9h       animatetext=setTimeout('moveBall()',20);%vq4v@ ?rg+fA
      }
xy j-Q I    }
W(j b:W`N _ V2k
5lIx5H\M B | function calculatePosition() {yyek6S
   if (xDir == "right") {
6s9D d3Yt.y]n       if (xPos > (xMax - contentWidth - BallSpeed)) {
u?&C#Ewq H          xDir = "left";
w rc!VJ Xrw          }
#N&_f3lQ       }
q6MJ-I$g#nWmG    else if (xDir == "left") {(?R:N$k n9e8cN}
      if (xPos < (0 + BallSpeed)) {F\P8j U#LX9K(@
         xDir = "right";
a#j[yq$r&m          }`m1yH H$QpG
      }
+s-nf;W(@D(D)\%Y9~    if (yDir == "down") {
rJV o1hWn       if (yPos > (yMax - contentHeight - BallSpeed)) {REYzv j M2c%j&@
         yDir = "up";K_X(Sf~
         }
b,Z_8\+\b0X~m       }mnu R |
   else if (yDir == "up") {
2BK3]"O/Qf$Q       if (yPos < (0 + BallSpeed)) {
T&@vouY6{V          yDir = "down";/C ]2Z`t\uJl
         }9Ev pG e&W,ek r
      }
ro!@ j ^?h    if (xDir == "right") {9jwS9_)^a
      xPos = xPos + BallSpeed;&Y;}1Z5U y~l ?
      }IQ |!C"V,}
   else if (xDir == "left") {1^ P8Q L2@!W
      xPos = xPos - BallSpeed;
`}u-M6L2q0a       } h!~&v+MOmT m
   else {
6\c.M!RK       xPos = xPos;
;^0y;l ~bh8e ~7[       }K.S7kP!d MQp0N
   if (yDir == "down") {'FZ,I ~Jvw T
      yPos = yPos + BallSpeed;
DLuJekV{       }'p~ptS4jj
   else if (yDir == "up") {
Z'L!q$N:q$O       yPos = yPos - BallSpeed;9_"g8x!_h Ob{2L`J,g
      }4hd-~ ]x'X"s+T
   else {)[*nzT~*Ew
      yPos = yPos;
PDt1y b e4I       }
2HS4pJ(R bu|;|    }#lS.g*[0Vk7K Dq]B
R ? BHIg
function hidetext(){
f(g$C/h6v:Q nL if (document.all)
&[:j^nh1jC0Q supertext.style.visibility="hidden"-yw_$Qv F
else if (document.layers)!anA-D9e^/u
document.supertext.visibility="hide" bFIC/h w
clearTimeout(animatetext)w!z&V+Z#O8w+L b
}TXSV T$`h)La

`n9L_*B6qR5v} if (document.all||document.layers){
'u~&X5Ap#~ b document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
bX+gE(s `nY"O window.onload = initializeBall;2\z0L \_+M
window.onresize = new Function("window.location.reload()");/K.R!Wmf/N&\6KMe
}
\BP f9c0c"yt3j-y $Skz$_w
</script>

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


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