捌玖网络工作室's Archiver

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

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

<style type="text/css">
2JF1?D1p"v #supertext {
&C!}"{zrV6CS position:absolute;
h)?8pke%\'S&I left:0;
V9np1[.S9] top:0;
p&G~9ig visibility:hide;
E,JF?3{ \$^W visibility:hidden;6q Vp8Ha:G'H.b1T
},i0_x7d_ iV i
</style>
1u4ITtc <script language="JavaScript1.2"> w6]} ~B7M8Lj"N
<!-- 改变下的字体的大小。颜色-->1o$Yc?T1L L3q.E
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'+N!\,R`#h0k{;o
var hidetimer='';
GL)xHR ] <!-- 改变下的弹跳速度-->
;m]7U`#}.K8F var BallSpeed = 20;
GBS1lO_K ezsx var contentWidth;i0["p!wdI
var contentHeight;,`zMfE-B
var maxBallSpeed = 50;D,b:h!u.~9N | c
B!Z7k!FtS
EgA-@kk
var xMax;
&Fd-]4v b-p*? var yMax;
*K1]6Ht~ var xPos = 0;
2y,H#U/C5V&l var yPos = 0;
GM3JHc9B var xDir = 'right';#]!tL'v?Xps
var yDir = 'down';A4nNpY }'lg;y.dd
var superballRunning = true;2_2j;cMx
var tempBallSpeed;
K;A7P:ZH| var currentBallSrc;U9K0IiQO!U)H
var newXDir;)L2se$\@4V:g0U
var newYDir;
vFEp)K/b:w9ol+mJn !M+T/Jj0E:Q
function initializeBall() {*n5no O8J%N0q
   if (document.all) {z!O1EE%PCkL
      xMax = document.body.clientWidth Y,R!u"Vw0K)Vq)}
      yMax = document.body.clientHeightbilJ+]"{H
      document.all("supertext").style.visibility = "visible";fm Q w!]rU uu/y
      contentWidth=supertext.offsetWidthz'y{ nd/G lY$si
      contentHeight=supertext.offsetHeightt2LuC(K'`
      }-TH!a%sH)[
   else if (document.layers) {
R Ttu6~       xMax = window.innerWidth;qxU]4M9VF*gc
      yMax = window.innerHeight;
c~4UyG0U_4S-q       contentWidth=document.supertext.document.width
4g!A7@#ZPas       contentHeight=document.supertext.document.height%fGB/S%uC
      document.layers["supertext"].visibility = "show";i!r8j5n'I;z7}
      }
OBmR)T"gk#Mw:a hf    setTimeout('moveBall()',400);!xu`,Ia nJ%d3W
   if (hidetimer!='')7["T M'F|L E-W
   setTimeout("hidetext()",hidetimer)
5o(u:BWBz)R%f7qhx    }
f b]j|*Fk{
:{K8t5z1Fj7I/Iy function moveBall() {
xy4d} NuM [:jPU*F    if (superballRunning == true) {
j1BT|6k"VBu7a       calculatePosition();;u l#`T:AsP
      if (document.all) { Wl$hc#kJ*]
         document.all("supertext").style.left = xPos + document.body.scrollLeft;K_6{+\{4W1_ `"^
         document.all("supertext").style.top = yPos + document.body.scrollTop;'D[Oo{ w-|
         }nbI@/v v| a]
      else if (document.layers) {"e8b3wfn3R
         document.layers["supertext"].left = xPos + pageXOffset;
!a R/u/T3x!U ?$o;d1U          document.layers["supertext"].top = yPos + pageYOffset;
ut0t }!}          } H/ydF5?/X4^S3B ?f|0H
      animatetext=setTimeout('moveBall()',20);[KdRh&U1? o![)i
      }
8Y;?GEwjx-J5v7jE    }
xhG4E5y}$] {?aB5A`9P
function calculatePosition() {eP~%~/p3^S,\
   if (xDir == "right") {
@Qqdg       if (xPos > (xMax - contentWidth - BallSpeed)) { z Ah2tD1o{D*A
         xDir = "left";YRx4QK"\
         }1GQ] \+P
      }
.z so2e&s|t!_S K    else if (xDir == "left") {
[p;r{f       if (xPos < (0 + BallSpeed)) {
"bj)^+I+?/|"e0~          xDir = "right";3g#VqZ xGi
         }{jvaHy2F L sk6@\j
      } uS8q2i9g6v-f"\r*rb
   if (yDir == "down") {
9I6Iz|n'VOZ9B       if (yPos > (yMax - contentHeight - BallSpeed)) {A;{ dhD J+xi9@6a~
         yDir = "up";
y%s-]HDa          }
1{S$^#bmC)l       }
U}4f(qn ll    else if (yDir == "up") { r/hT8r n
      if (yPos < (0 + BallSpeed)) {
FJ)R R:D:op^U          yDir = "down";kA8yf7E;C.zR
         }CX&b!^D ]`aV2i
      }7QP/A4Ys%Lt
   if (xDir == "right") {L @(`8_'Q)TE[
      xPos = xPos + BallSpeed;
*qwq`#o       }3P.j&B F:n gx
   else if (xDir == "left") {
/E*bC ro]~q}       xPos = xPos - BallSpeed;
.T`|u2di.{       }
7jp9@C%c jL$`i&j    else {
.@5BLA1U:p'e]       xPos = xPos;
-SGD4uU       }
[d O3~!k    if (yDir == "down") { |+|+PMt
      yPos = yPos + BallSpeed;T8F_ N s4c4xW+F
      }2ka7i(G7k{4V
   else if (yDir == "up") {
7|&R,\Y$X8B       yPos = yPos - BallSpeed;
Y@#Y;g!s"CCy7iw       }
5Z1JbS\K2t    else {"`Np Y S
      yPos = yPos;
1D u9j$}:i3p0AzC       }&\f$v Y;[8zE7f8y8A
   }^[Vdm,`Ip.IA

A5vZ m'Uc8L-X function hidetext(){
_YF%tM2ds#R)ME u if (document.all)
;` E#yd#T7g)[q!K E;r#f supertext.style.visibility="hidden" ]1mf [A&s'{+F\;|Z
else if (document.layers)6]\F@(D9Ljh
document.supertext.visibility="hide":wtdq9~ib{8m-k
clearTimeout(animatetext)[0_vw2l
}W#rH9^.T)yPF
n5Q B.n_*G6E
if (document.all||document.layers){ fFB A+["G%f1s
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
a@XS~ i/E window.onload = initializeBall;
*_5?9e'[4_'q$N window.onresize = new Function("window.location.reload()");
-` nC@3`} }/W0A D+a6vB&r
*V+a~\^
</script>

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


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