捌玖网络工作室's Archiver

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

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

<style type="text/css">
$b$KL.hT #supertext {
"x;P4sW3u position:absolute;
Rb,R3?rp'B left:0;dQ N"E%l7CS
top:0;
.U&c)`3R-p visibility:hide;1e a R3w[
visibility:hidden;:GI,at`SR*n] C0B
}VI5E}+b$pHl3oMf
</style>
BAy!J{&i2b7uhp <script language="JavaScript1.2">
0y'y-} Z l <!-- 改变下的字体的大小。颜色-->3i4x+~VU{h s-rA
var thecontent='<h2><font size="2" face="宋体" color="FF0000">欢迎光临七色风网页家园</font></h2>'`ftm/{f2T Hh
var hidetimer='';
,Nm1~CM4m7fI a <!-- 改变下的弹跳速度-->
n{GrN#j var BallSpeed = 20;$u-Y$F1vhsPh} M
var contentWidth;"{t\f|
var contentHeight;We-q h%Tk"M|%Ch
var maxBallSpeed = 50;A4S%S7hM&a"wxW

3d]2nW@%q%gk2KtU r4v[d`&S
var xMax;
O M c [I?9iv var yMax;kqt5}.Q.i3QD{
var xPos = 0;
p2e'g&D X var yPos = 0;
l|*@[)o-oBr var xDir = 'right';
0fIoT}V var yDir = 'down';PjE1S5\[/Y![
var superballRunning = true;,?7w)A)tg.j H
var tempBallSpeed;R i?5^ \*M3Dd
var currentBallSrc;
f,M yE'N VgJ var newXDir;
f7AjS*@ f6} var newYDir;/o6[+SRI@Fs
H I F8g,],y:fX
function initializeBall() {Ww(Q/a(Edw0c7v&Kl
   if (document.all) {
)Ao7|a-l5xTK       xMax = document.body.clientWidth2M J9nBGEEEl
      yMax = document.body.clientHeight
8A(l'K.xTK:Vo8ovdH       document.all("supertext").style.visibility = "visible";
5['}v!dL"{5X       contentWidth=supertext.offsetWidth
1G;o$vQoK*S D       contentHeight=supertext.offsetHeight@:nw!mT
      }0k z:N:}b"@#S
   else if (document.layers) {
v3u,lFW;`,A5IT       xMax = window.innerWidth;
*H*d$AI+G       yMax = window.innerHeight;F DSC2\o/eZt`
      contentWidth=document.supertext.document.width
-UY Vb!W ~qS       contentHeight=document.supertext.document.height
6Q0[(X(? E%n)p%v       document.layers["supertext"].visibility = "show";~-^n3S9SMl&m.?$j|7o
      }#w"{:K'q(m
   setTimeout('moveBall()',400);.b j/Q4H3@ed;~
   if (hidetimer!='')(AF%r {i-a[O]
   setTimeout("hidetext()",hidetimer)3Fp0q$aT q+r
   }
!oTp1k4b@ L#C9N S
-@;_C(Y1T [S function moveBall() {
h'L#|Q _&f(At;VR    if (superballRunning == true) {
]0wQf?B,p @/p B       calculatePosition();4K W7i(U't
      if (document.all) {#O(fj8Yy?Ok
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
?Z,y%?5iZ(M          document.all("supertext").style.top = yPos + document.body.scrollTop;
Aq^\5I"I          }
s7K:\] S)vlj       else if (document.layers) {O"^ GT`
         document.layers["supertext"].left = xPos + pageXOffset;(^R+o'dp.G${
         document.layers["supertext"].top = yPos + pageYOffset;
by7q \.zc          }iq9V:H b9H zMD
      animatetext=setTimeout('moveBall()',20);
S,]._mpXz4o@I       }+a8kFBv,J
   }
]&P&`"K!d NG ^1}
6p"aT)f _1~ function calculatePosition() {4J {JD FO I
   if (xDir == "right") {
stSR1\#z\/z2R T       if (xPos > (xMax - contentWidth - BallSpeed)) {
T K;G4j*s          xDir = "left";
7P)E#N'Udzh          }
U3d%gq}']%m       }
{J.rzS U] r'B)v    else if (xDir == "left") { X0b,S,Zdrth
      if (xPos < (0 + BallSpeed)) {Xf \zno2X&m
         xDir = "right";:L'T_sYy,M6v%e
         }So[|\!A
      }t | Y(l%M
   if (yDir == "down") {j!wP `D;EQL
      if (yPos > (yMax - contentHeight - BallSpeed)) {MHhH-t$X*U e
         yDir = "up";
h Z'r r W[0GJ*^6M          })Y N XvuA
      }*a#B2i)l/S![z8A
   else if (yDir == "up") {
{ l\ uC(\5q[+c/Og       if (yPos < (0 + BallSpeed)) {'k4s^Sn2]$\[
         yDir = "down";
h9E K%^ a*I)D          }
;o&UDp"Z#j|8J B$R       }
S#BYYr ]+J}    if (xDir == "right") {
TY;HU"x[ A       xPos = xPos + BallSpeed;
H&L \ R,T]       }
UOV?,|h    else if (xDir == "left") {
])L$y] b5cei8n       xPos = xPos - BallSpeed;
(}^7|!j&i       }n*E,tS@]
   else { NI*uEIQMQs5w Q
      xPos = xPos;[H7q/[$z*^+P]6cH0h
      }J&mEAVl(k
   if (yDir == "down") {
,nc6^ ] oI?@#^Gg       yPos = yPos + BallSpeed;
+o0u;@A]&X5fP"D V s       }
D;I,Uqe dO2H9s4I    else if (yDir == "up") {VG%I2s%~1s(F.qP
      yPos = yPos - BallSpeed;
wbeh g K"KO-}/a       }
_}j X)}8V$a/E{    else {
{ @'sP#h(H6Z;NZ       yPos = yPos; SM|"JEc
      }
*Q:W4AG1w,A    }
;w$b\2tKd#n4p K4l&x!sy Lw,_Z
function hidetext(){,a4mZ)G M6Qg0Th-J
if (document.all) F!G&Pvp#~C})N*m"f
supertext.style.visibility="hidden";gO [Nj(]/D
else if (document.layers)
J'H"i QzR document.supertext.visibility="hide"
4@ M/kn8r L4d clearTimeout(animatetext)
+j$DhZ#L)UV$t M6m3\ }_9A6P _AW
(q`KNY;e T/h0\
if (document.all||document.layers){
8e:i@wl document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')V,nG%}9m0y%v}r
window.onload = initializeBall;
g!Y%ZWM~]%T,d window.onresize = new Function("window.location.reload()");WBRlu8Y1}L%y
}
'x)t nlZq%C9~g x+D8i~+jg
</script>

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


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