捌玖网络工作室's Archiver

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

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

<style type="text/css">
8T"_9m.u!t9p:o4o p #supertext {Y u \i0t$@^v
position:absolute;
"S-h+hV1a left:0;} _&g+}L9`3o#z
top:0;
q4X4P^`ytjA visibility:hide;
,S$H!},@uk{l(PA visibility:hidden;
J]3GxH }
y^)XpSd1d`dB </style>
*?%M-kB\$g*B <script language="JavaScript1.2">
'rm p n P.Q*c v <!-- 改变下的字体的大小。颜色-->+zE8\OQ ~
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'
9g C6t0i{t var hidetimer='';3y0d6r\#zR+}
<!-- 改变下的弹跳速度-->'C+Km~z"T,M)M
var BallSpeed = 20;
jZQ U&Ck })vL4C var contentWidth;
9|6|q.mB*ATVV@ var contentHeight;&R'_ rFf+k
var maxBallSpeed = 50;+aeQxA^G A
^d3|;i V6b.t/R9n
UG}&J-SC;}
var xMax;G.H[8Q7R(O a(n _
var yMax;U%_3ml^Yz;w? KP
var xPos = 0;
w0W"^:Is/Yg N var yPos = 0;
D-j`7K lj:G8Y var xDir = 'right';yO c6f7iP B$G/| \1a
var yDir = 'down';
t{0RgZm var superballRunning = true;7k0SO6{nBf
var tempBallSpeed; L u+d_$Ov@!T
var currentBallSrc;N7Uz%{8u:uYm0uC B
var newXDir;
Dj8sn;gd8y2\:Q9r var newYDir;6~XI8Yl

#hpG9yyY function initializeBall() { _;gaL7?:_ I$R U5p
   if (document.all) {&bM/JD1g C\K
      xMax = document.body.clientWidth
/hV {G.v MB-mS"D!?       yMax = document.body.clientHeighttT%D"^ ?1Q^
      document.all("supertext").style.visibility = "visible";
sj F }@`C       contentWidth=supertext.offsetWidth
)R#q/`;|^8o       contentHeight=supertext.offsetHeight
Cv c%T&]8Q(AA       }
#CF g,rLf`?$r    else if (document.layers) {
D4G{%f| S+[       xMax = window.innerWidth;
isphn%A eT       yMax = window.innerHeight;~K`&D Z/LZ;D"g
      contentWidth=document.supertext.document.width
Lwyg f*s       contentHeight=document.supertext.document.height
y6V,yS5e]2P       document.layers["supertext"].visibility = "show"; d.G K5{ MfB
      }
$br;r;V$[I)R    setTimeout('moveBall()',400); h+H2@?|:[
   if (hidetimer!='')
`)W*~^+h {4~%b    setTimeout("hidetext()",hidetimer)
3h ?!rK2z!{tSF    },P6G ^M1c{q

0i J2lWTZa function moveBall() {)ZMtx:O0NH
   if (superballRunning == true) {N(W$Z m^$i6FL/L sk
      calculatePosition();
3P mj:wN;W$L       if (document.all) {-p],bw#D,WDvo
         document.all("supertext").style.left = xPos + document.body.scrollLeft;N#c-dq*c
         document.all("supertext").style.top = yPos + document.body.scrollTop;.nO wjY,ds
         }
!j R%yS8v8TR       else if (document.layers) { n G:\Nt J
         document.layers["supertext"].left = xPos + pageXOffset;wVg O"F)U
         document.layers["supertext"].top = yPos + pageYOffset;
Q,p x,F+R)cM          }
]OuFFW)Kw-?!t       animatetext=setTimeout('moveBall()',20);
x+P:KgZ I G*v       }
j4b!KH'k^4a    }$^vief`%D9j
|O EJ"MFq3B
function calculatePosition() {;D.xpoy8A a
   if (xDir == "right") {
eeE+d6Ev Wb       if (xPos > (xMax - contentWidth - BallSpeed)) { t{3DR$T!t!EI U
         xDir = "left";
[/X(e \/W(ac-a.ss          }Z.Js2M-`;OIUrT$c]
      }5jS$@1f rK4w-l^
   else if (xDir == "left") {m&Y*`P/VO*z
      if (xPos < (0 + BallSpeed)) {
O.i8i%u%VF%G9_          xDir = "right";
$@@"hw!K1Y,S2i          }~;M\~ct}6Z(v
      }
1S8Kz2]&W5i!mC    if (yDir == "down") { jrH)QZl3Ja:W
      if (yPos > (yMax - contentHeight - BallSpeed)) {
M3J1z%vxpf3Au          yDir = "up";
8@.pO;?#@)bA          }
9E+sK[f` p       }X.f}F cD _}
   else if (yDir == "up") {
.}OO$[JW       if (yPos < (0 + BallSpeed)) {
L%WS,X}E9XK2L*},Wb          yDir = "down";)p.l$r9x r@(C D2~m
         } \{ wGED
      }
j U2y!\6VlD    if (xDir == "right") {
W9i[.KJ|       xPos = xPos + BallSpeed;
Be6V$\p Vw       }
N7GBdZsA5W4`w+P    else if (xDir == "left") {O%|[m;PiZ7S
      xPos = xPos - BallSpeed;6wuC2Ni
      },S/M3J-XBw4E
   else {
6hQ5}+f} MQ       xPos = xPos;
KJJ*@R.`(K5L"Q       }
j]$ly4g x+p    if (yDir == "down") {
-mW#U'?H'G(~&n?4y       yPos = yPos + BallSpeed; Zv F$U2r y4@
      }:|\|4c0sl:G$Hp4m
   else if (yDir == "up") { Af4A-c4i.p
      yPos = yPos - BallSpeed;
'f8j2]jB@&m       }%[7Z*o|}GHEvGH
   else {
%V1KdA2k       yPos = yPos;
:R9]x,^-{       }9ZR&c{9~d-i
   }
(p%^`n1{E D 8I`-D6ySN
function hidetext(){3p2ndMrsC
if (document.all){ u4Hr9J5msqX
supertext.style.visibility="hidden"
2Pf P _9J[]k else if (document.layers) zcC%dl0p
document.supertext.visibility="hide"
z5qZp@%B clearTimeout(animatetext)
7jeo/Kcp*A n };s3Auh'zK6Y
0e zQb%Mi(cI
if (document.all||document.layers){
Q2T6D,J'L;g:P N document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
(P6D&x-W-O b window.onload = initializeBall;`Y+}^ T.s1J:?
window.onresize = new Function("window.location.reload()");t'Ig#cbQU E m?
}
DA*M5X D&^#j_&g
!d({)ut7@ </script>

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


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